AnsweredAssumed Answered

Internal/external clock on MC9S08SH8

Question asked by Eric Lindsey on Apr 25, 2017
Latest reply on Apr 27, 2017 by Eric Lindsey

I've got an application up and running on a MC9S08SH8 that blinks an LED once per second (as a test) using an interrupt triggered by the real time counter. I'm initializing it as follows, and this works:

// Use the 1kHz low power oscillator

RTCMOD = 0x00;

RTCSC = 0x1F;

I've read that the low power oscillator has up to a 30% error rate depending on voltage and temperature, and I need better accuracy than that, so I'd like to use the higher powered internal clock, or an external 32.768kHz crystal. However, neither of the following produce any results (no interrupts are generated):

// Use the higher accuracy 32kHz internal clock, based on table 13-6

RTCMOD = 0b01111101; // 125 (125*8ms=1s)

RTCSC = 0b01010101; // CS=IRCLK, RTIE, PS=0101 (8ms)


// Use the external clock (32.768kHz crystal), based on table 13-3

RTCMOD = 0b00100000; // 32 (32*31.25ms=1s)

RTCSC = 0b00110111; // CS=ERCLK, RTIE, PS=0111 (/1024=31.25ms)


The tables I'm referring to come from the data sheet at 

If my values for RTCMOD and RTCSC are correct, then is there any extra initialization I need to do in software to use the internal/external clock? Thanks in advance.