More playing about with timers. I was using timer1 with a 32768 xtal, interrupting every second. Xtal was running slow. So I decided to try using timer1 driven from the internal osc (20mHz xtal on a '877). Figured out how to load the timer in the interrupt routine without screwing up the time interval. Now I get one interrupt every 10 milliseconds, and can keep track of time of day. My problem: I'm displaying the time on an LCD - the code uses bit-banging to do the output. (I'm using PicBasic Pro, so I didn't code the LCD stuff myself). Every once in a while the display hiccups - presumably because the timer interrupt routine went off in the middle of sending data to the LCD, and disrupted the timing. Same thing happens if I send the output via bit-banging serial output (again in PicBasic Pro) I presume that I could disable interrupts before doing the I/O, and turn them on after. In this case, I think that the timer1 counter would contain a number equal to the number of instruction cycles taken by the LCD routine. Since I have to preload the counter in the interrupt routine anyhow, in order to get an interrupt every 10 msecs, I think I can compute a new preload based on the existing counter, so the next timer cycle will be shorter, to compensate for the time lost in the LCD routine. This is my first time experimenting with timers and interrupts. Is what I'm proposing a good way to do this? Anyone got any better ideas? Thanks Larry Bradley Orleans (Ottawa), Ontario, CANADA -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu