Dispensing Capsules
I am trying to program a machine to dispense 2 halves (Male and Female) of plastic capsules after a button is pressed. I have an arm that pushes the stack of capsules which opens the connection of the tabs that are keeping the capsules in place. Once a single capsule is released, the tabs close and the motors stop until the button is pressed again. If the pusher arm reaches the bottom it hits a limit switch and backs off. I have the hardware working correctly, the emergency (limit) switch working correctly, and I can get it to dispense the male half, but then it just turns the motor for the female half on and off really quickly without dispensing. I have gotten the program to work successfully with just the male capsule or just the female capsule. My code is attached as well a a picture of the system. I am not very experienced with programming, so any advice would be great!
Also, is there any way to get these two subroutines to execute simultaneously? Maybe using a different method than I have used?
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
Post Edited (RGR_Engineer) : 12/2/2009 11:07:20 PM GMT
Also, is there any way to get these two subroutines to execute simultaneously? Maybe using a different method than I have used?
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
Post Edited (RGR_Engineer) : 12/2/2009 11:07:20 PM GMT
Comments
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
en.wikipedia.org/wiki/State_diagram
en.wikipedia.org/wiki/Finite-state_machine
www.cs.unc.edu/~stotts/145/CRC/state.html
yourdon.com/strucanalysis/wiki/index.php?title=Chapter_13
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Don't worry if it takes a while to learn state diagrams. They are generally take a couple of lectures to introduce (in my experience).
Don't be deterred. Your flowchart/transition diagram is a good start. Here's how I would suggest structuring your program. It will make a lot more sense to you, I think, if you look at it in these terms:
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Tara
Post Edited (skylight) : 12/4/2009 4:17:56 AM GMT
-Phil