- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello !! Thanx everyone to solve my previous query so quickly.. 🙂
i am facing a simple problem that i have made my sub modules of voltage measurment, voltage averager, probe logic and frequency measurment individually and everything is working fine !! But when i combine them all in main module using switch case, the frequency measurment part doesn't work.. any idea why it is creating such problems ?? i have attached my code along with my post..
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where is the declaration of your interrupt procedure for the timer? I miss a CY_ISR or a CY_ISR_PROTO?
I usually would write
ISR_Counter_StartEx(MyInterruptRoutine);
to exactly define what I want.
Your program is poorly readable, it takes some time to see, which button-value is for which part of your program, why not #define Button_Frerquency_Count 1 and so on.
Why not put the whole case-block into a separate function
case Button_Frequency_Count: Count_Frequency();
break;
case Button_Measure_Voltage: Measure_Voltage();
break;
Check your comments for correctness.
Check your comments for nessicity: "LCD_Position(0,0);//Position cursor on LCD" here the comment is obsolete
Check your Indentation
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yup.. i think it is the problem i am facing.. but where should i initialize the timer interrupt routine ?? the code is going upto printing the frequency statement on lcd.. but i think it is not going further.. any help ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Initialize the interrupt and the Timer-Module once, then (if you prefer) you can disable them with the appropiate API-Call.
In the corresponding procedure you can enable/restart them and(again if you prefer) disable them.
The right place would be the function (I hope you already took it out of the switch-block) where you measure frequency.
I (normally) put an isolated function like measuring the frequency into a complete different .c-file and make a .h interface. Later when programming a completely different project I have the opportunity to re-use that piece of software.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
as per suggetion i used counter initialization and isr initialization outside the switch case.. but still no success.. 😞
i am doing it wrong ?? can you please modify my original code so that i will fully understand my mistake and will try to avoid them in future..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Post your latest change here
2. Tell us what you change and why do you change it?
3. People here may help you so you can learn how to fish. not to give you a fish.