Generating Pulses
Richard Chamberlain
Posts: 3
Hello,
I'm completely new to the Basic Stamp and need advice about how to proceed in a project.
I have a requirement to generate pulses to control a stepper motor. The board controlling the motor has 2 pins, one of which is controlling direction (just high or low) and another which accepts pulses.
Essentially I would like to recreate the sort of utility you get with the Little Step-U board, i.e. generate a number of pulses per second and be able to ramp up and down to that speed. I would use the Little Step-U except that I believe that actually powers the motor as well, which in this case is not required.
Finally I need to be able to control this via a serial port, but I presume I can do this through the debug port?
I have got the BS2P40 stamp and can generate pulses using pulsout easily enough but the timing between pulses looks like it will be difficult to control when I start adding code in the loop. For instance widening the pulse seems to also increase the gap between pulses as well for some reason.
Does anyone have any advice for how I should go about doing this?
Many thanks,
Richard
I'm completely new to the Basic Stamp and need advice about how to proceed in a project.
I have a requirement to generate pulses to control a stepper motor. The board controlling the motor has 2 pins, one of which is controlling direction (just high or low) and another which accepts pulses.
Essentially I would like to recreate the sort of utility you get with the Little Step-U board, i.e. generate a number of pulses per second and be able to ramp up and down to that speed. I would use the Little Step-U except that I believe that actually powers the motor as well, which in this case is not required.
Finally I need to be able to control this via a serial port, but I presume I can do this through the debug port?
I have got the BS2P40 stamp and can generate pulses using pulsout easily enough but the timing between pulses looks like it will be difficult to control when I start adding code in the loop. For instance widening the pulse seems to also increase the gap between pulses as well for some reason.
Does anyone have any advice for how I should go about doing this?
Many thanks,
Richard
Comments
Please post your code. We can do very little without seeing it.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
"What's the difference between ignorance and apathy ?"
"I don't know, and I don't care."
·
Well I haven't got any code to show at the moment.
I've been just testing with a DO LOOP:
DO
PULSOUT 5, 50
LOOP
Just to see what output I get. Obviously the number of milliseconds between pulses is due to the speed of the processor but it also seems to lengthen depending on the actual period. Of course it will also increase when I add code between the DO and LOOP. So my question is really how can I avoid that? Is there another component I can offload this to to get better control of it?
Thanks,
Richard
The PULSOUT processing you're hopng to do without other interference can easily be done by an offboard processor which runs independently of the Stamp. Here is one such co-processor:
http://www.awce.com/pak8.htm
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Rolling my own is probably a little beyond me at this point.
The pulse output co-processor looks interesting but not quite what I need reading through the manual.
Can anyone suggest any other pulse generators that I can set an accurate pulse time in milliseconds, have some kind of counter for pulses and be able to ramp the speed up and down relatively easily.
To give you an idea of the accuracy I require the pulses will often be used to trigger a linescan camera which requires a constant 20ms pulse.
Any suggestions would be greatly appreciated.
Many thanks,
Richard