??? 10/10/05 09:00 Read: times |
#102153 - handling interrupts. Responding to: ???'s previous message |
Hi patrick,
Thanks for your reply.The variable i is used as index to get the channel number , say I modified the code which i written previously itwas like this ref main() while(1) { for(i=0;i<5;i++) { EA = 0; // disable interrupts voltage = result[i];// get ADC value from global variable EA = 1; // re-enable interrupts voltage = voltage * VREF0; voltage = voltage >> 16; printf ("Channel '%d' voltage is %ldmV\n",i, voltage); } } since i have added switch option in the project then i removed the for loop. now i tried to do like this when ever swicth is pressed we will find interrupt and the programme updates 'i' value, since 'i' is declared as global. when it comes to main after executing A/D interrupt A/D converted data ie result[i] gives the channel number channel 0 voltage is 0mv channel 1 voltage is 2mv channel 2 voltage is 1mv channel 3 voltage is 4mv channel 4 voltage is 0mv if again switch pressed then i need result in the above manner Thanks in advance raghav |
Topic | Author | Date |
How to handle interrupts in this code | 01/01/70 00:00 | |
what about i? | 01/01/70 00:00 | |
handling interrupts. | 01/01/70 00:00 | |
the dangers of 'i' | 01/01/70 00:00 | |
debounce switch | 01/01/70 00:00 | |
errare humanum... | 01/01/70 00:00 | |
Using interrupts with switches![]() | 01/01/70 00:00 |