PWM Motor Control
I'm trying to control two Victor 883 speed controllers using PWM. The v883s expect pulses between 1 and 3 ms in length (I'm pretty sure), and I'd like to be able to vary the duty cycle between 10% and 100%.
Right now I'm using lightly modified example code posted by JonnyMac found here:
http://forums.parallax.com/forums/default.aspx?f=7&m=258538
The PWM in the code works, but the pulses are too short for the v883 to recognize (about 3/4 ms). I tried changing the clock speed, but that did not change the pulse duration, only the period of time for which the pulses occurred. When I put it in non-Turbo mode, the pulses were too long (about 14 ms in length).
Any ideas how to time the pulses correctly?
Furthermore, I on the professional development board, I have rb.0 running to servo channel 0 and rb.1 running to servo channel 1. It appears signal is only coming out of pin rb.1. I verified this with my scope by switching wires around. It's probably a problem with my breadboard (hope not) or something along those lines.
Strike that. It's a problem in the code.
Thanks for any and all help!
=================================
Fake edit:
I'm reading about PULSOUT, and that is probably the solution. However, is there something akin to the PAUSE function which takes its argument in us, not ms?
Pseudocode example:
PWM_Freq = 200 ;; 200us
PWM_ON = 50 ;; 50us
PWM_OFF = 200-PWM_ON
;;Begin interrupt
PULSOUT PWM_ON
WAIT PWM_OFF
;;end interrupt
Edit: I had a thought. I could just PULSOUT on an unused pin, couldn't I?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Christopher Agocs
Georgia Institute of Technology
Post Edited (Christopher Agocs) : 6/16/2008 3:29:27 PM GMT
Right now I'm using lightly modified example code posted by JonnyMac found here:
http://forums.parallax.com/forums/default.aspx?f=7&m=258538
The PWM in the code works, but the pulses are too short for the v883 to recognize (about 3/4 ms). I tried changing the clock speed, but that did not change the pulse duration, only the period of time for which the pulses occurred. When I put it in non-Turbo mode, the pulses were too long (about 14 ms in length).
Any ideas how to time the pulses correctly?
Furthermore, I on the professional development board, I have rb.0 running to servo channel 0 and rb.1 running to servo channel 1. It appears signal is only coming out of pin rb.1. I verified this with my scope by switching wires around. It's probably a problem with my breadboard (hope not) or something along those lines.
Strike that. It's a problem in the code.
Thanks for any and all help!
=================================
Fake edit:
I'm reading about PULSOUT, and that is probably the solution. However, is there something akin to the PAUSE function which takes its argument in us, not ms?
Pseudocode example:
PWM_Freq = 200 ;; 200us
PWM_ON = 50 ;; 50us
PWM_OFF = 200-PWM_ON
;;Begin interrupt
PULSOUT PWM_ON
WAIT PWM_OFF
;;end interrupt
Edit: I had a thought. I could just PULSOUT on an unused pin, couldn't I?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Christopher Agocs
Georgia Institute of Technology
Post Edited (Christopher Agocs) : 6/16/2008 3:29:27 PM GMT
Comments
Just remember that the PULSOUT command is specified in terms of resolution AND duration in microseconds. If the maximum pulsewidth you need is 3ms, then the resolution should be set to 12 (3_000us / 255) or higher to fit in a byte. That means PULSOUT YourPin, 83, 12 is roughly equal to 1ms (or 1% capacity), and PULSOUT YourPin, 254, 12 is roughly equal to 3ms (or 100% capacity). 254 - 83 is 171, so you have approximately 171 steps of resolution to deal with.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Paul
One odd thing I recall about the Victor 883 is that some radios (like Futaba) often required the use of an inline device to "buffer" to signals. How do you have them connected to your SX chip? You may need to look at what these inline buffer devices did. If the signal isn't getting to the Victor 883 then perhaps adding a pullup resistor may fix the problem.
Robert
I was having trouble finding good documentation about the 883s, but taking what you said into consideration with what I've read, I think you're right. I'll modify my code to fit.
There appears to be some sort of buffer (looks like an IC on a small PCB covered in heatshrink) in the cables going to the Victors. The device I'm working on was built years ago; I'm just trying to remodel it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Christopher Agocs
Georgia Institute of Technology