- Posts: 1931
- Thank you received: 394
Gmoccapy - A new screen for linuxcnc
- newbynobi
- Offline
- Moderator
-
Less
More
8 years 9 months ago #104565
by newbynobi
Replied by newbynobi on topic Gmoccapy - A new screen for linuxcnc
Hallo Calep,
the way I connected it will loose the spindle in two ways:
If motion.spindle-brake gets hight, also pin-08 will get hight and loose the spindle
if the button is pressed, pin-08 will get also hight and the spindle brake will open.
as long as the button is pushed, the brake will be opened!
If you want a way to "reset"the button if the motion.spindle-brake changes its state, I would take a look on a flip-flop component.
It would be possible to reset the button also using a python handler.
So first we need to clear exactly what you are expectiong the button should do!
Norbert
the way I connected it will loose the spindle in two ways:
If motion.spindle-brake gets hight, also pin-08 will get hight and loose the spindle
if the button is pressed, pin-08 will get also hight and the spindle brake will open.
as long as the button is pushed, the brake will be opened!
If you want a way to "reset"the button if the motion.spindle-brake changes its state, I would take a look on a flip-flop component.
It would be possible to reset the button also using a python handler.
So first we need to clear exactly what you are expectiong the button should do!
Norbert
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
Less
More
- Posts: 4793
- Thank you received: 1480
8 years 9 months ago - 8 years 9 months ago #104574
by Todd Zuercher
Replied by Todd Zuercher on topic Gmoccapy - A new screen for linuxcnc
Sometimes the simplest thing to do is write out all the posible logic states and what you want to happen, then go from there.
For the above I believe a simple and2 should suffice.
| motion.spindle-brake | Button | Spindle brake on | ||
| 1 | 0 | 0 | ||
| 1 | 1 | 1 | ||
| 0 | 0 | 0 | ||
| 0 | 1 | 0 |
Last edit: 8 years 9 months ago by Todd Zuercher.
Please Log in or Create an account to join the conversation.
- dhanger
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 2
8 years 9 months ago - 8 years 9 months ago #104575
by dhanger
Yeah, I've already done that much
I don't think your particular values are quite right (but maybe you were just trying to give an example, and not necessarily trying to provide everything exactly as it should be), as it seems to me like the spindle brake should never be set if the spindle is in motion (but I will double check that with my dad). Further complication is that, from what I've observed, I believe the brake is *set* if the pin is *off*, and *released* if the pin is *on*. So it takes some careful thought to come up with the right truth table, but I think I've got that part pretty well under control. Thanks. 
Cheers,
Caleb
Replied by dhanger on topic Gmoccapy - A new screen for linuxcnc
Sometimes the simplest thing to do is write out all the posible logic states and what you want to happen, then go from there.
motion.spindle-brake Button Spindle brake on
1 0 0
1 1 1
0 0 0
0 1 0
For the above I believe a simple and2 should suffice.
Yeah, I've already done that much
Cheers,
Caleb
Last edit: 8 years 9 months ago by dhanger.
Please Log in or Create an account to join the conversation.
- dhanger
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 2
8 years 9 months ago - 8 years 9 months ago #104576
by dhanger
Replied by dhanger on topic Gmoccapy - A new screen for linuxcnc
Norbert --
I told my dad how the or2 solution is going to look and feel, and he's completely great with that, so I don't think we need to mess around with flip-flops and Python handlers. I'm thinking we're probably good for now, especially with the example of or2 usage you provided. But I'll post again if we run into more problems that we can't solve on our own. Thanks again!
Cheers,
Caleb
I told my dad how the or2 solution is going to look and feel, and he's completely great with that, so I don't think we need to mess around with flip-flops and Python handlers. I'm thinking we're probably good for now, especially with the example of or2 usage you provided. But I'll post again if we run into more problems that we can't solve on our own. Thanks again!
Cheers,
Caleb
Last edit: 8 years 9 months ago by dhanger.
Please Log in or Create an account to join the conversation.
- dhanger
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 2
8 years 9 months ago - 8 years 9 months ago #104583
by dhanger
Replied by dhanger on topic Gmoccapy - A new screen for linuxcnc
Whee! It's working perfectly now. As it turns out, I was wrong about the brake being released if the pin is on and set if the pin is off. It's the other way around; if the pin is turned on, the brake is set, and if the pin is off, the brake is released.
What was throwing me off was that "motion.spindle-brake" -- I discovered using the "halshow" utility that if *that* is *off* then it means the spindle *is* in motion, but if it's *on* then it means the spindle is *not* in motion. What we want is for the brake to be set if and only if the spindle is *not* in motion *and* the new button I added is pressed. So, that ended up just being a simple, straightforward AND operation between the spindle motion signal and the button. Interestingly, this also means that the values in Todd Zuercher's truth table were actually exactly right. Todd, did you somehow know that the "motion" signal would be *off* if the spindle *is* moving, and *on* if it's *not* moving?
Anyhow, spindle_brake_button.hal now looks like this:
Now everything works just as he wants.
Again, huge thanks to everyone who contributed to helping us get this worked out!
Cheers,
Caleb
What was throwing me off was that "motion.spindle-brake" -- I discovered using the "halshow" utility that if *that* is *off* then it means the spindle *is* in motion, but if it's *on* then it means the spindle is *not* in motion. What we want is for the brake to be set if and only if the spindle is *not* in motion *and* the new button I added is pressed. So, that ended up just being a simple, straightforward AND operation between the spindle motion signal and the button. Interestingly, this also means that the values in Todd Zuercher's truth table were actually exactly right. Todd, did you somehow know that the "motion" signal would be *off* if the spindle *is* moving, and *on* if it's *not* moving?
Code:
loadrt and2 names=spindle_brake_AND
addf spindle_brake_AND servo-thread
net brake-input-0 motion.spindle-brake => spindle_brake_AND.in0
net brake-input-1 spindle_brake_button.spindle_brake_button => spindle_brake_AND.in1
net brake-output spindle_brake_AND.out => parport.0.pin-08-out
Now everything works just as he wants.
Again, huge thanks to everyone who contributed to helping us get this worked out!
Cheers,
Caleb
Last edit: 8 years 9 months ago by dhanger.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
Less
More
- Posts: 4793
- Thank you received: 1480
8 years 9 months ago #104596
by Todd Zuercher
Replied by Todd Zuercher on topic Gmoccapy - A new screen for linuxcnc
Actually yes I did. I checked the function of the motion.spindle-brake pin in a VM simulation before I posted.
Please Log in or Create an account to join the conversation.
Moderators: newbynobi, HansU
Time to create page: 0.427 seconds