| ??? 04/11/06 04:22 Read: times |
#114049 - Code Review Responding to: ???'s previous message |
for(;;) // round Robin multitasking loop
{
if(bitFlags.msecFlag) // process when 1 msec tic occured by 1msec timer interrupt
{
bitFlags.msecFlag = 0; // reset msec flag waiting for next tic
if(bitFlags.repeatUpFlag) // process when repeat up flag activated by debounced up switch
{
if(++repeatUpCntr == 250) // button pressed for 250 msec
{
repeatUpCntr = 0; // reset repeat up counter
repeatUp(); // increment the displayed number relative to cursor position
outFreq2(freqToOut); // generate displayed frequency
dispFreq(); // display the incremented frequency
}
}
if(bitFlags.repeatDnFlag) // process when repeat down flag activated by debounced down switch
{
if(++repeatDnCntr == 250) // button pressed for over 250 msec
{
repeatDnCntr = 0; // reset repeat down timer 1msec increments
repeatDn(); // decrement the displayed number if positive depending on cursor position
outFreq2(freqToOut); // generate displayed frequency
dispFreq(); // display the decremented frequency
}
}
switch(systemState) // PROCESS KEY SWITCH ENTRY IF ANY
{
case STATE0: // check if New switch pressed?
-
-
rest of code
using the 1 msec debounce timer made the process of repeat function very simple and only few lines of code! Any comments to improve this code are welcome. Mahmood |
| Topic | Author | Date |
| LCD repeat function in C | 01/01/70 00:00 | |
| First thought | 01/01/70 00:00 | |
| if its roundrobin | 01/01/70 00:00 | |
| last post | 01/01/70 00:00 | |
| Sounds fine | 01/01/70 00:00 | |
| the one issue | 01/01/70 00:00 | |
| stuck key | 01/01/70 00:00 | |
| Yes | 01/01/70 00:00 | |
| Code Review | 01/01/70 00:00 | |
| this must be excellent switches | 01/01/70 00:00 | |
excellent debounce for bad switches | 01/01/70 00:00 | |
| better code version | 01/01/70 00:00 | |
| no comments, captals, no indenting | 01/01/70 00:00 | |
| It could do with some improvement! | 01/01/70 00:00 | |
| I did not comment on that, it may very w | 01/01/70 00:00 | |
| true.... | 01/01/70 00:00 | |
| led to so much misinformation in this fo | 01/01/70 00:00 |



