Page 1 of 1

ZX24u PWM

Posted: 25 March 2024, 23:20 PM
by kurakaira
Strange behavior with PWM ch10 on a ZX24u .

If i have PutPin(17, 0) before OpenPWM , i get a voltage output of 0-600mV .
If i have PutPin(17, 1) before OpenPWM , i get a voltage output of 600mV-3.3V .
If i leave out the PutPin , the PWM is good 0-3.3V .

Re: ZX24u PWM

Posted: 27 March 2024, 16:49 PM
by dkinzer
I looked at the xMega datasheet and the ZBasic code and discovered that the PutPin() prior to setting up PWM are not required for the xMega devices. The ZBasic code for PWM configures the corresponding to be an output so that s why it works without the PutPin() call. This is a deficiency in the documentation.

For the xMega, if you want to change the polarity of the PWM signal you have to set up the pin for inverted output using

Code: Select all

Call PutPin(pin, zxInvertIO)