??? 06/17/06 02:40 Read: times |
#118454 - Practical programming Responding to: ???'s previous message |
Hello Russel,
Below is the code I am referencing. It updates TH0 without shutting off any interrupts which is considered bad programming practices. My question is with such abundant resources (free 9,900 Microseconds to thumb twiddle each timer 0 interrupt) as in this program why bother with shutting off interrupts. The comment about the peanut gallery was to try to get comments limited to this example and leave person opinions out of the discussion. Regards, Charles Bannister =================================================== void timer_isr (void) interrupt 1 using 1 { TH0 |= 0xdc; // reload timer 0 with 0DC00H cputick++; time(); // update realtime clock } =================================================== void time () /* update real-time clock */ { sec100++; if (sec100 >= 100) /* 100 * 10 ms = 1 s */ {sec100 = 0; flag1 |= 0x05; /* set bit 0, bit 2 */ temp = 50; sec++; if (sec >= 60) {sec = 0; flag1 |= 0x02; /* set bit 1 */ min++; if (min >= 60) {min = 0; hour++; if (hour >= 24) {hour = 0; } } } } } |
Topic | Author | Date |
Timer0_ISR delay troubles | 01/01/70 00:00 | |
Why it doesn't work | 01/01/70 00:00 | |
Extra Atomic | 01/01/70 00:00 | |
Been there Done That | 01/01/70 00:00 | |
Yes,very atomic | 01/01/70 00:00 | |
nuclear explosions | 01/01/70 00:00 | |
Also | 01/01/70 00:00 | |
Thanks everyone | 01/01/70 00:00 | |
learn to swim before diving in | 01/01/70 00:00 | |
using 1 | 01/01/70 00:00 | |
Some code from the prof broke interrupt | 01/01/70 00:00 | |
Nevermind | 01/01/70 00:00 | |
which it is not | 01/01/70 00:00 | |
Explain?![]() | 01/01/70 00:00 | |
What happend to common sense? | 01/01/70 00:00 | |
specific examples are dangerous | 01/01/70 00:00 | |
Uncommon Sense | 01/01/70 00:00 | |
Practical programming | 01/01/70 00:00 | |
Charles | 01/01/70 00:00 |