My problem very easy, can PWM be turned off? how?
Below my assembly code:
ON_PWM LDA #%00001000
STA TPM2SC
LDA #%00101000
STA TPM2C1SC
LDHX #$4000
STHX TPM2MOD
LDHX #$2000
STHX TPM2C1V
RTS
OFF_PWM LDA #%00001000
STA TPM2SC
LDA #%00100000
STA TPM2C1SC
LDHX #$4000
STHX TPM2MOD
LDHX #$4000
STHX TPM2C1V
RTS
When I put the OFF_PWM first (piezo buzzer no sound), then ON_PWM, my Piezo Buzzer will sound.
But if i put the other way, ON_PWM first (piezo buzzer sound), then OFF_PWM, my piezo buzzer still continue to sound. :-/
Anything I missing? Anyone can help? Any flag need to be cleared b4 turn off PWM? I can't find any answer from datasheet. Ty in advance.