Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/13/06 22:42
Read: times


 
#126441 - C8051F340 CKCON weirdness?
Maybe late Friday is playing tricks on my eyes, but from what I can tell the order of operations on CKCON matters. I am configuring a UART0 using TIMER1 and I'm using TIMER0 as a tick timer. If I modify the prescaler (SCA1:SCA0) *before* the Timer 0 Clock Select (T0M) the everything is fine. If I configure T0M first, then the prescaler, then my tick timer is /8 too fast. Timer0 ignores the prescaler setting.

More detail (CKCON starts at 0x00):

Works:
   :
CKCON = (CKCON&0xFC)|0x01;  // Set prescaler to /4. UART_CLK/baud/4
   :
CKCON = CKCON | 0x04;       // T0 uses SYSCLK (UART uses prescaler).
   :

Does not work:
   :
CKCON = CKCON | 0x04;       // T0 uses SYSCLK (UART uses prescaler).
   :
CKCON = (CKCON&0xFC)|0x01;  // Set prescaler to /4. UART_CLK/baud/4
   :


In both cases the final CKCON is 0x05.

??!!!


No replies in thread

Back to Subject List