I am evaluating the Keil uVision2 tool with a C8051F010 target. I am attempting to read the timer0 registers as free running timers. I see no capture registers for timers 0 & 1 as there are for timer 2. Using the Keil environment, I am looking for a meathod (interupt free) of reading timer 0/1 that can capture both bytes of the timer without stoping the free running timer. (This is to port code designs from HC05/11 applications which make use of their free running timer capture feature.) Regards, Harold Kraus
I am attempting to read the timer0 registers as free running timers. I see no capture registers for timers 0 & 1 as there are for timer 2. Well the part appears to be a standard 8052 core part, thus, like the traditional 8051 and 8052, there are no capture/compare registers for T0 or T1. Your best bet on reading them free-running is to read TxH, read TxL, and re-read the TxH (where x = 0 or 1) to ensure it has not changed. If it has, restart the sequence. - Mark
Your best bet on reading them free-running is to read TxH, read TxL, and re-read the TxH (where x = 0 or 1) to ensure it has not changed. If it has, restart the sequence. Hey, that's MY algorithm! Jon :-)
Jon, I actually stumbled upon this recently using the PowerPC '860. It has a 64-bit (wow!) time base counter that is a wonderfully monotonically increasing counter that won't wrap for several millenia. Anyhow, this algorithm is described in the user manual. I didn't actually come up with it. But it does confirm your logic, eh? - Mark
Jon and Mark, Belated thanks. Harold