Ezra Godfrey

PWM Setup Issue I Can't get the TPMCH1 to work

Discussion created by Ezra Godfrey on Jan 11, 2007
Latest reply on Jan 13, 2007 by Joerg Schnyder
I am Using a MC9S08QG8 and I have been trying to figure out how to use PWM on the TPMCH1 for ever and I can't seem to figure it out. I have successfully configured the TPMCH0 to work and I have tested it both with the True - Time Simulator and buy hooking up Port A pin 0 to an H-Bridge and Watching as my motor turns.

Here is the initialization code that i am using.

void MCU_init(void) {
SOPT1 = 0x00;
TPMMOD = 0x00FF;
TPMC0V = 0x0049;
TPMC1V = 0x00A7;
TPMC0SC = 0b00111000;
TPMC1SC = 0b00111000;
TPMSC = 0b00010000;
PTADD = 0xff;
PTBDD = 0xff;
PTAD = 0x00;
PTBD = 0x80;

and after the MCU_init(); function runs there is a infinite for loop.

Does anyone know what the problem is