external clock in pwm mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

external clock in pwm mode

865 Views
eaegalera
Contributor I
I am developing a project using 9S08QG4.
In my project I am using the following configuration for PWM:
  TPMSC = 0B00001000;
  TPMC0SC = 0B00101000;
  TPMC0SC_ELS0B = 0;       
  TPMMOD = 100;
  TPMC0V = 50;
This configuration perfectly works!
He happens that the need appeared of synchronizing my pwm with the electric (220V) net, then I changed the configuration of the TPMSC register for:
 TPMSC = 0B00011000;
to use the pin TCLK as entrance of the clock of the connected pwm in the net. I verify with the oscilloscope and he has a wave of 3,2V of width and 60Hz of frequency in the pin TCLK but the out of the pwm channel doesn't alter. What this lacking?

Thank you
Labels (1)
0 Kudos
1 Reply

276 Views
bigmac
Specialist III
Hello,
 
If the following lines are actually used (for either TPM clock source), this will actually disable the timer channel output.
TPMC0SC = 0B00101000;
TPMC0SC_ELS0B = 0;  /* PTA0 pin reverts to GPIO */
 
Be aware that, by using a 60Hz external clock, the PWM frequency will be 60/100 = 0.6Hz.  I am not sure if this is your intention.
 
If you actually need to synchronise the edge of the output waveform to a zero-crossing of the 60Hz waveform, this is a somewhat different problem, probably involving input capture and output compare operations, rather than PWM.
 
Regards,
Mac
 


Message Edited by bigmac on 2007-06-22 02:29 AM
0 Kudos