PWM Duty Cycle or Pulse measurement example spin code
I have a Propstick that is working fine.·
I have an RC controller receiver that delivers several differing pulse widths in a row; each width controls the speed of a·robot motor.·
I am seeking example PWM Duty Cycle. or Pulse measurement, spin code.
Although Chapter 4 of the Manual mentions these words, I find no examples there or elsewhere.
Who can help?
EdKirk
Post Edited (EdKirk) : 6/4/2006 1:27:49 AM GMT
I have an RC controller receiver that delivers several differing pulse widths in a row; each width controls the speed of a·robot motor.·
I am seeking example PWM Duty Cycle. or Pulse measurement, spin code.
Although Chapter 4 of the Manual mentions these words, I find no examples there or elsewhere.
Who can help?
EdKirk
Post Edited (EdKirk) : 6/4/2006 1:27:49 AM GMT
Comments
A more elegant method of doing what you want (using a cog's counters) is outlined in Martin Hebel's BS2 function library availible in the Objects Library Download section of the Propeller website.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
I have tried to use waitpe/waitpne without success.
I have been successful with
PRI MeasureOneCycle
····· Repeat While Ina[noparse][[/noparse]8]
····· Repeat While Not InA[noparse][[/noparse]8]
····· Time1 := Cnt
····· Repeat While Ina[noparse][[/noparse]8]
····· Time2 := Cnt
····· Repeat While Not InA[noparse][[/noparse]8]
····· Time3 := Cnt
····· Highs := (Time2 - Time1)/80
····· Lows· := (Time3 - Time2)/80
····· Cycle := (Time3 - Time1)/80
Giving answers in us on my monitor.
But would like to see how to use waitpe?
EdKirk
You can use the following to call the above and convert it to uS depending on your clock speed.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Southern Illinois University Carbondale - Electronic Systems Technologies
Personal Links with plenty of BASIC Stamp info
StampPlot - Graphical Data Acquisition and Control
In its own cog, it could keep the variables updated.
I'm not sure what you mean by "several differing pulse widths in a row; each width controls the speed of a robot motor. " Do you have several different channels to monitor for different motors, or one motor that receives a sequence of PWM commands, or ????
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
And thank you for asking about my project.· I am using a Vex (Don't tell on me) robit kit and I have copied the Kiwi which I found others have built.· I and others had great difficulty controlling its movement.· Its frame is an equilateral triangle wth a·wheel at each corner; each wheel is an Omni Wheel which has rollers around the rim; each roller is parallel to the rim so that the wheel exerts no thrust along its own axis.· This remarkable structure can rotate about its own axis and it can move in the x-y plane at any compass point.· One friend of mine suggested that this is an ideal set of movements for a wheel chair.· Just imagine being able to scoot sideways along the kitchen counter!
The Vex controller has a PIC controller which I might have reprogrammed, but I wanted to get familiar with my new PropKit.· The six channel Vex radio receiver delivers one sync pulse and six PWM pulses to the controller.· Each pulse can range from one to two msec long; there is a one msec pause between each and the cycle is repeated 50 times per sec.
I am cutting that cable and inserting the PropKit to receive 4 channels from two joysticks and send three channels to the motors.
Ed·Kirkham· ·edk@wi.rr.lcm
I'd love to hear how your project turns out.
Kerry
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks for your interest. I will let you know how it goes. My tentative plan now (I am always in a tentative state of mind) is to use two joysticks, one to control rate and direction of rotation, the other to control rate and direction of travel in xy.
It will still be hard for the operator to keep track of which direction +x will take him. Therefore I plan to install (independantly of the PropStick) a small video camera from my junk box which has a radio link to my good old, old Radio Shack 5-inch monitor. A shaft encoder on the servo controlled pan axis of the camera will hopefully make it possible to move left or right in the picture. A double throw toggle switch will then allow me to continue to use the monitor for debugging the PropStick.
Any suggestions are welcome.
This is a misuse of this forum. If you prefer send along your email address.
EdKirk
Ed Kirkham edk@wi.rr.com