Phil Nguyen

Interrupts using MC9s08GB60A

Discussion created by Phil Nguyen on Aug 6, 2008
Latest reply on Aug 9, 2008 by bigmac
I am new at this so any help and as detailed as possible would be great.  I am using the MC9S08GB chip with a 32.769K crystal as the reference for a clock.  I set the ICGC1 to FEE mode and crystal reference.  Then I have the ICGC2 to set the Ficgout to ICGCE = 0x00 so the Ficgout = 8.39MHz.  So then Fbus = Ficgout/2 = 4.19MHz.  The next step i did was to set up my TPM2SC = 0x4A, which divides Fbus, as its source, by 4 to  create  a timmer with a frequency of 1048576 Hz (essentially an interrupt is set for every .954 usec)  then i have IRQSC = 0x3A for the TPM1SC which is another interrupt for writing to the EEPROM.
 
I am trying to create a clock with good accuracy (internal clock will not suffice).  So what my questions is how do I set up to have an interrupt at every 100usec instead of possibly .954 usec?  I believe i have to configure the TPM2MOD but im not quick sure how to or how it works.  If anyone has a better way of doing this, please let me know.  I appreciate it. 

Outcomes