PWM Question

Discussion specific to the DIP and TQFP packaged ZX devices like the ZX-40, ZX-44, ZX-32 and ZX-328 series. The differences between these devices is primarily the packaging and pinout so most issues will apply to all devices.
Post Reply
rich_mays
Posts: 4
Joined: 07 March 2007, 13:43 PM

PWM Question

Post by rich_mays »

I tried running the example in the ZBASIC manual for the PWM function. After verifying that the pulse train should drive a servo, I ran the program, but got no response from the servo. I changed the duty cycle parameter from a Single to an Integer, using the same percent values, and the servo worked fine.

Has anyone else run into this? Is there additional setup required when using the PWM(Byte, Single) overload of the function?

Thanks,
Rich
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: PWM Question

Post by dkinzer »

rich_mays wrote:Has anyone else run into this? Is there additional setup required when using the PWM(Byte, Single) overload of the function?
We were able to reproduce the problem that you identified - it is an error in the code generator portion of the compiler. You can work around the problem temporarily using code like that below:

Code: Select all

Dim duty as Single
duty = 50.0
Call PWM(chan, duty)
- Don Kinzer
rich_mays
Posts: 4
Joined: 07 March 2007, 13:43 PM

Post by rich_mays »

Thanks for the quick response!
Post Reply