Where to find simple programs online?
ScottB
Posts: 8
Hello everyone,
I need to write a very simple program, we are going to have a four button joystick and basically when you push forward it will close a switch that will be an input to the stamp that will have an output to a relay that will drive a motor until it hits a limit switch.
Then repeat that process for each of the four directions.
I expect someone has written something similar to this, is there any online program library I can access?
Thank you,
Scott
I need to write a very simple program, we are going to have a four button joystick and basically when you push forward it will close a switch that will be an input to the stamp that will have an output to a relay that will drive a motor until it hits a limit switch.
Then repeat that process for each of the four directions.
I expect someone has written something similar to this, is there any online program library I can access?
Thank you,
Scott
Comments
Use 'InA' to read P0..P3 for the joystick buttons.
Write a small routine that will start moving the motor, based on joystick inputs.
In your 'main' loop, monitor the state of the limit switches, and gosub to turn off any 'hit' motors.
I expect you have 4 joystick switches, 4 motor control lines (reversible, right?· That makes it a little difficult), 8 limit switches (one for each extreme of each motor).
Okay, you just ran out of I/O pins on the BS2 -- it has 16.· If you replace the 'Motor' with modified Servo's, you save 4 pins, and can now have 8 limit switches.
Post Edited (allanlane5) : 3/18/2005 9:05:39 PM GMT
I read through the form a little and maybe I should explain what·I am trying to do (although Allen seems to have gotten the idea)
We have a joystick that will close·one of four·switchs depending depending which direction you push it.
We have an airplane model with motors and limit switchs in it.
Push joystick forward, close switch, tail flaps motor run until limit switch is closed.
repeat for roll, turn, etc.
Thanks,
Scott
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
"A problem well defined, is a problem·half solved."
·
Joystick to right, tail rudder to right, plane rotates right, etc.
Once I have code for one function I'm thinking I can just copy it for the others, problem being that although I like programming in basic I haven't done so since school days (+ ten years) so any help will greatly be appreciated. Do you think it would help if I posted this over at the robotics form? Heck we have the robot sumo here!
Thanks,
Scott
Actually 4 joystick switches - nose up/down - roll left/right - AND two buttons turn left/right
3 motors in plane
6 limit switches in plane
3 motors outside plane
6 limit switches outside plane
I count 12 outputs and 18 inputs - we plan on using a 32 I/O Parallax stamp.
Anyone want to help me reanimate a F-20?
Thanks,
Scott
Are you trying to access the motors through the A-B PLC? Which PLC is it? This sounds like one of the Slic-50 or 500 series Controllers?
Ladder logic is easy but takes a diffrent mind set. Also A-B Has made the entry level programming software very expensive.
If you are trying to eliminate the A-B then the stamp is a good way to go.
What type of motors are you using? There is a way to use a BS-2 , as you can put some of the travel limit switches in series with the direction control relays.
My assumption is that the control feedback loop is using good old Mark I eyeballs.
Set up the direction limit switch in series with the direction relay coil. When the limit has been reached, the relay shuts off and no further travel will occur. And you saved an output. When you drive the motor in the oppisit direction with the other relay it will drive off the likit switch and head to the other direction limit. Wire this switch the same way.
If all you are trying to do is make the plane follow the Joystick you almost dont need a stamp at all (Sorry Parallax!!).
If you want some automatic preprogrammed movements then the stamp will be necessary and you will need the Stamp to read the limit switches.
You can also cheat the I/O limit by putting all the limit switches in parallel for a particular axis of movement.(Assuming more than one axis will move at a time).
The software is what is making the motor move and knows which direction it is moving. Therefore there is only one limit it can hit. Drive the motor till it·sees the limit·input activate,·and you know which one it is by the direction. It dosent matter that 2, or 4 are in parallel you know which one based on the direction of the motor.
I use this in my X-Y·drive systems that use Stamps and run out of I/O's. It works slick. More software overhead but less I/O pins.
Let me know if you have any more questions.
Alan Bradford
Plasma Technologies
·
I actually would like to learn ladder logic however I am more familiar with Basic even though it has been some time since I have fooled around with programming other that simple DOS.
We are (were) using an A-B micrologix 1500 however we are using parallax stamps in more of our exhibits so it is more practical and cost effective to use the stamp.
I tried to talk my supervisor into just hard wiring the exhibit but he prefers using the stamp so we can add more features later, for now we just want to see it work ASAP.
All the limit switches are run to the PLC and the motors that physically move the plane are rather large (the plane model is over three feet long)
They say a picture is worth a thousand words so...
Maybe it's current software program is alright but there's a hardware failure....That might be just as easy to diagnose then to redo the whole thing!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://ca.geocities.com/steve.brady@rogers.com/index.html
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
I am convinced using the proper interface components the F-20 can be revived. I would start by confirming the proper operation of each motor and limit switch, by manually driving each. If you plan on keeping each interface component (relays and what not), test each one of those and replace any that aren't functioning.
If you confirm that all mechanical parts are operating properly, you can be assured that reviving the display is possible. The best way of devising your control program is by creating a flow chart. Start with action boxes and decision boxs describing general behavior. Take a look at the attached example, once you do this you'll find the programming to be pretty straightforward. Also you should test and verify the operation of each operation by itself such as "pitch up" in a ground up approach of programming it, that way whenever you experience a problem, you know its at your current level and lower level functions performed are not the culprit.
The attached flow diagram is not complete obviously but hopefully it will get you on your way. One thing you may consider is incorporating the limit switches as a kill switch for the motor (ie hardware not under control of the stamp), so that the motor is energized if and only if neither of the·limit switches·for that motor are activated. This way you will aleviate some of the control nessesary for the stamp to perform and it will also prevent damage if for some reason the stamp goes into lala land either in development or operation.
PS sorry about the quality of the flow diagram, I only have access to MSpaint at the moment (Adobe Illustrator is at home)
Post Edited (Paul Baker) : 3/22/2005 9:31:40 PM GMT
I think the easiest way to fix this is to junk the PLC, if no one has any idea what the ladder looks like. Even if the program is in the PLC to extract it you will get a ladder without any documentation as to what each element does.
The flowchart method is a good place to start. You need to know what you want to happen when. Then you can hook up the motors and limit switches.
It looks like the motors are turned on/off with relays. This will be easy to do with a stamp. I use Solid State Relays driven from the stamp pins, to drive relays. You can use AC or DC SSR's depending on the Relays you want to drive.
I would take out everything that is not needed, and then wire the stamp into the circuit.
Looks like it should take about 8 hrs to wire and the same to program. A fun project.
It beats controlling dirty, greasy cutting machines.
Good Luck,
Alan Bradford
Plasma Technologies
Thanks for that idea and the running the limits in parallel.
No one here know ladder logic however many of us know basic so we are much more enthused about converting to a basic. Converting to something other than the PLC has already been determined.
Yes it could all be done using nothing more than relay however there are some extra things we may want to add down the line such as. Joystick right - rudder right - momentary delay - plane move right. also we may want to have the plane center itself if left idle for a predetermined amount of time.
Thanks for all the help, I'm open to any other ideas.
Perhaps you can adapt a form of this circuit http://www.edn.com/article/CA323022.html?spacedesc=designideas·you would take out the current sensing portion (IC2) since it is performing the same function as your limit switches, and feed the limit switch into the reset of appropriate D-flip flop, to deactivate the motor via the button no longer being depressed, would require the feeding a stamp signal in there as well. And perhaps this isn't the best circuit, but I like the idea of using the reset of a register to disable the motor. Anyways its some food for thought.
Ah it just occured to me, the reason the feedback between the two flip flops is there is to ensure that both portions of the hbridge aren't simulatenously activated (a very bad thing) by pressing both switches, but your joystick (plus your stamp being thrown into the decision making process) will prevent this from happening, so you can feed the output from the stamp directly into the D input, the clock would need to be driven by a clock source (provide by stamp or otherwise) to cause an update of the output of the D flip flop.
If I get bored tonight and my roomate isn't using my computer (she's studying for an insurance liscence, and I boffo'ed up her computer by accidentally visiting a malware site) I'll redraw the schematic with the changes and post it.
Post Edited (Paul Baker) : 3/23/2005 1:05:26 AM GMT
If you are ever in Los Angeles and visiting the Science Center I can get you into the IMAX.
Two of the guys here in the shop have some kind of similar flip flop circuits I have been looking at trying to incorporate.
I am open to any other ideas
Thanks,
Scott
One way would be to place a reverse biased diode in parallel with each limit switch.
That way the only time the diodes (one on each switch) would need to "work" would
be at the extreme ends when switching direction.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
Latest Company News
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071