Hi All,
We are trying to setup a QE8 to produce a variable duty cycle for a motor drive. The timer is set to run continuously.
The WDT is disabled.
Below is the code we are using. The output pin on the 28 pin SOIC has been re-routed to PC0/TPM1CH2.
The toggle output on channel match works fine and we get a 50% DC pulse at the desired period.
The problem we have is changing to Edge-aligned PWM. It just does not work.
Obviously we are missing something, any help is appreciated.
; setup timer period, values are for 100Hz [$0520] [100 prescale]
mov #$05,TPM1MODH ;load period into high byte of timer modulo register
mov #$20,TPM1MODL ;load period into low byte of timer modulo register
; setup timer pulse width, larger value decreases pulse width
mov #$01,TPM1C2VH ;load output compare into high byte of timer value register
mov #$10,TPM1C2VL ;load output compare into low byte of timer value register
mov #%00001100,TPM1SC ;CPWMS clear for edge aligned PWM, bus clock source, prescale
; mov #%00101000,TPM1C2SC ;output compare, high true PWM pulse - THIS PRODUCES NO OUTPUT, PC0 STAYS LOW
mov #%00010100,TPM1C2SC ;output compare, high true PWM pulse - THIS WORKS
aa bra aa : stay in loop