AnsweredAssumed Answered

PWM question for HCS08 series

Question asked by Ben Seaman on Jun 16, 2010
Latest reply on Jun 21, 2010 by Ben Seaman

We are using the HCS08 series 8 bit micro's in our two different project.

Our first project used the MC9S08GQ8.
We created an output clock toggling on PB5 and it worked fine.
Below is the C section for this.


 PTBD_PTBD1 =1;    // Port B/1 is POWER LED  0 = on
 PTBDD_PTBDD1 = 1; // Set PTB1 as an output

 PTBD_PTBD2 =0;    // Port B/2 is -RESETDSP   0 = -DSP IN RESET
 PTBDD_PTBDD2 = 1; // Set PTB2 as an output  put dsp into reset

 PTBD_PTBD3 =1;    // Port B/3 is -DSPPDN    1 = POWER ON
 PTBDD_PTBDD3 = 1; // Set PTB3 as an output

 PTBD_PTBD4 =1;    // Port B/4 is -ENCLASSD SET OFF 0= AMP ON
 PTBDD_PTBDD4 = 1; // Set PTB6 as an output




   // MAX count = (PWM count * 2) - 1 for 50% duty
 TPMMODH = 0;      // Channel 1 Max count  (HIGH)
 TPMMODL = 67 ;    // ""(TPMC1VL *2)-1=50% (LOW)
 TPMC1VH = 0;      // Channel 1 PWM count  (HIGH)
 TPMC1VL = 34;     // ""   26                (LOW)
 TPMC1SC = 0x28;   // Channel 1 Edge-aligned, High-true
 TPMSC = 0x08;     // !Center-aligned, use BUS-clock, divide by 1



Now for our new project we are using the MC9S08SL8.
We try and toggle the same PB5 bit and you can see the pin initialize
however we cannot get an output clock to form.
Below is the C code used.
Is there a power down register that we have to enable or a turn clock
signal on that we cannot find in the datasheet here.
Any input would be greatly appreciated.



 PTCD_PTCD3 =1;    // Port B/1 is POWER LED  0 = on
 PTCDD_PTCDD3 = 1; // Set PTB1 as an output

 PTBD_PTBD2 =0;    // Port B/2 is -RESETDSP   0 = -DSP IN RESET
 PTBDD_PTBDD2 = 1; // Set PTB2 as an output  put dsp into reset

 PTBD_PTBD3 =1;    // Port B/3 is -DSPPDN    1 = POWER ON
 PTBDD_PTBDD3 = 1; // Set PTB3 as an output

 PTBD_PTBD4 =1;    // Port B/4 is -ENCLASSD SET OFF 0= AMP ON
 PTBDD_PTBDD4 = 1; // Set PTB6 as an output

 //PTBD_PTBD5 =1;    // Port B/5
 //PTBDD_PTBDD5 = 1; // Set PTB5 OUTPUT



   // MAX count = (PWM count * 2) - 1 for 50% duty
 TPM1MODH = 0;      // Channel 1 Max count  (HIGH)
 TPM1MODL = 135 ;    // ""(TPMC1VL *2)-1=50% (LOW)
 TPM1C1VH = 0;      // Channel 1 PWM count  (HIGH)
 TPM1C1VL = 68;     // ""   26                (LOW)
 TPM1C1SC = 0x28;   // Channel 1 Edge-aligned, High-true OK
 TPM1SC = 0x08;     // BUS-clock ,divide by 1


Thanks,

Outcomes