| ??? 11/10/03 02:51 Read: times |
#58173 - RE: Timer 0 interrupt problem ? Responding to: ???'s previous message |
Methinks the root cause of many problems could be that no registers are saved onto the stack for the timer interrupt. The minimum should be the status reg and ACC and anything else that gets trashed. I would also not recommend tying up R7 for the interrupt routine - use ram or alternate register bank. Another comment is that writing to the lcd display is SLOW so I wouldn't do it in the interrupt routine - have the interrupt code copy the port value to a memory location and set a bit to say it is available - the main line code tests this bit, displays the value then clears the bit. I think it takes about 100uS per character to write to the lcd display. I didn't read the code close enough to get the tick time, but if the time to write all the chars to the lcd display is greater than the tick time , one might have some troubles, as we haven't finished the lcd writing yet and another interrupt comes along. example code: timer_int() { static char tick_count = 0; if (tick_count != 0 ) { tick_count--; } else { tick_count = TICK_TIME; p1_hold = P1; flag =1; } } main() { init_lcd(); setup_timer(); char p1_hold = 0; bit flag = 0; while(1) { if (flag !=0) { printf("Port1 %x",p1_hold); flag = 1; } } } Where possible, keep the interrupt routines simple and lean as possible without having to resort to nasty tricks. |
| Topic | Author | Date |
| Timer 0 interrupt problem ? | 01/01/70 00:00 | |
| RE: Timer 0 interrupt problem ? | 01/01/70 00:00 | |
| Want to insult us? -100 points! | 01/01/70 00:00 | |
| RE: Want to insult us? -100 points! | 01/01/70 00:00 | |
| RE: Want to insult us? -100 points! | 01/01/70 00:00 | |
| RE: Want to insult us? -100 points! | 01/01/70 00:00 | |
| RE: Want to insult us? -100 points! | 01/01/70 00:00 | |
RE: Want to insult us? -100 points! | 01/01/70 00:00 | |
| RE: Timer 0 interrupt problem ? | 01/01/70 00:00 |



