Turning an output on and off...
- racedirector
- Offline
- Elite Member
Less
More
- Posts: 267
- Thank you received: 42
06 Sep 2015 18:45 #62165
by racedirector
Turning an output on and off... was created by racedirector
Hi there
I used to have a system on my Mach3 install that flashed one of the outputs of my breakout board via a bd679 "relay" and now I want to do the same with LinuxCNC, Can anyone point me to any docos or ways of possibly creating timers to flash different sequences due to different states in LinuxCNC like, pausing, tool change requests, VFD errors or driver errors etc? I would appreciate some pointers
Cheers
I used to have a system on my Mach3 install that flashed one of the outputs of my breakout board via a bd679 "relay" and now I want to do the same with LinuxCNC, Can anyone point me to any docos or ways of possibly creating timers to flash different sequences due to different states in LinuxCNC like, pausing, tool change requests, VFD errors or driver errors etc? I would appreciate some pointers
Cheers
The following user(s) said Thank You: Nickel
Please Log in or Create an account to join the conversation.
06 Sep 2015 20:08 #62167
by BigJohnT
Replied by BigJohnT on topic Turning an output on and off...
Possibly the time delay component is what you seek.
www.linuxcnc.org/docs/2.7/html/man/man9/timedelay.9.html
JT
www.linuxcnc.org/docs/2.7/html/man/man9/timedelay.9.html
JT
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
Less
More
- Posts: 267
- Thank you received: 42
07 Sep 2015 11:58 #62180
by racedirector
Replied by racedirector on topic Turning an output on and off...
Thanks JT, I'll see if that'll do the job. Next thing to figure out will be how to map the extended inputs and outputs on the PMDX-126 with hal..... should be an interesting one
Please Log in or Create an account to join the conversation.
08 Sep 2015 17:50 #62238
by andypugh
What sort of flash-codes did you have in mind? What is the input signal?
Unless you are using a parallel port I would imagine that separate lights for each state would be easier. Or text entries in a GUI element.
It is relatively easy to change the frequency of a flash using HAL components, but anything more elaborate is probably easier in a custom HAL component. I can imagine mapping bit patterns from a MUX16 into the init pins of a shift register made from flipflops. But frankly that seems crazy.
Replied by andypugh on topic Turning an output on and off...
I used to have a system on my Mach3 install that flashed one of the outputs of my breakout board via a bd679 "relay" and now I want to do the same with LinuxCNC, Can anyone point me to any docos or ways of possibly creating timers to flash different sequences due to different states in LinuxCNC like, pausing, tool change requests, VFD errors or driver errors etc?
What sort of flash-codes did you have in mind? What is the input signal?
Unless you are using a parallel port I would imagine that separate lights for each state would be easier. Or text entries in a GUI element.
It is relatively easy to change the frequency of a flash using HAL components, but anything more elaborate is probably easier in a custom HAL component. I can imagine mapping bit patterns from a MUX16 into the init pins of a shift register made from flipflops. But frankly that seems crazy.
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
Less
More
- Posts: 267
- Thank you received: 42
08 Sep 2015 18:17 #62242
by racedirector
Replied by racedirector on topic Turning an output on and off...
What I "need" is the ability to flash a 24V LED on the machine in different sequences depending on different states of the control. In Mach I had a sequence for pause, a sequence for toolchange requests, a hard on on EStop, another sequence for when my AM882's went into alarm and still another when the VFD went into alarm. In Mach I used their macros to manage the state of Mach and then pulse the output of pin 16 which has a BD679 setup as a relay. The pulses would turn the BD679 on an off i sequence which would then flash the LED's on the machine.
The triggers where the state of Mach and for the alarms the status of 2 other pins on the breakout board. These pins are turned on an off with relays in the control box.
The triggers where the state of Mach and for the alarms the status of 2 other pins on the breakout board. These pins are turned on an off with relays in the control box.
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
Less
More
- Posts: 267
- Thank you received: 42
08 Sep 2015 18:39 #62244
by racedirector
Replied by racedirector on topic Turning an output on and off...
Just to add, it wasn't macros, it was a brain. Brains were basically AND/OR/IF/THEN gates that triggered from either STOP/PAUSE/ESTOP or input pins on the board. The resulting sum off all that was output to pin 16 in a series of pulses from timer objects.
Please Log in or Create an account to join the conversation.
08 Sep 2015 18:40 #62245
by andypugh
The LinuxCNC equivalent of a Mach3 macro is a custom component.
These can be written in C (for hard-realtime components) or Python (for userspace components).
Be aware that a reatlime component can't pause, halt, or wait. It has to run straight through every time, so the component structure would look a bit like
{define pins etc}
;;
If the input value has changed, change the flash pattern (int 32)
decrement the timer by the thread period
if the timer has expired:
shift the bit pattern right
set the LED output to bit 0
reset the timer
If you do it in Python then the timing will be less precise, but the code is allowed to wait/pause etc.
It sounds like you had a moderately complicated set of inputs to control the flash sequence?
Replied by andypugh on topic Turning an output on and off...
In Mach I used their macros to manage the state of Mach and then pulse the output of pin 16 which has a BD679 setup as a relay..
The LinuxCNC equivalent of a Mach3 macro is a custom component.
These can be written in C (for hard-realtime components) or Python (for userspace components).
Be aware that a reatlime component can't pause, halt, or wait. It has to run straight through every time, so the component structure would look a bit like
{define pins etc}
;;
If the input value has changed, change the flash pattern (int 32)
decrement the timer by the thread period
if the timer has expired:
shift the bit pattern right
set the LED output to bit 0
reset the timer
If you do it in Python then the timing will be less precise, but the code is allowed to wait/pause etc.
It sounds like you had a moderately complicated set of inputs to control the flash sequence?
Please Log in or Create an account to join the conversation.
08 Sep 2015 18:49 #62247
by andypugh
Well, I would _still_ use a custom component, but you could do it with:
1: A mux_generic with as many inputs as you need patterns, and a U32 output controlled by your input logic.
2: Separate the individual bits from that mux into a second mux with bitslice
3: drive the second mux from a an updown component driven by a siggen clock output.
linuxcnc.org/docs/html/man/man9/mux_generic.9.html
linuxcnc.org/docs/html/man/man9/bitslice.9.html
linuxcnc.org/docs/html/man/man9/updown.9.html
linuxcnc.org/docs/html/man/man9/siggen.9.html
Replied by andypugh on topic Turning an output on and off...
Just to add, it wasn't macros, it was a brain. Brains were basically AND/OR/IF/THEN gates that triggered from either STOP/PAUSE/ESTOP or input pins on the board. The resulting sum off all that was output to pin 16 in a series of pulses from timer objects.
Well, I would _still_ use a custom component, but you could do it with:
1: A mux_generic with as many inputs as you need patterns, and a U32 output controlled by your input logic.
2: Separate the individual bits from that mux into a second mux with bitslice
3: drive the second mux from a an updown component driven by a siggen clock output.
linuxcnc.org/docs/html/man/man9/mux_generic.9.html
linuxcnc.org/docs/html/man/man9/bitslice.9.html
linuxcnc.org/docs/html/man/man9/updown.9.html
linuxcnc.org/docs/html/man/man9/siggen.9.html
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
Less
More
- Posts: 267
- Thank you received: 42
08 Sep 2015 18:58 #62249
by racedirector
Replied by racedirector on topic Turning an output on and off...
WOW, so many new things.... a learning experience rather than a problem Thanks for the links, I'll do some study and the playing to see what happens.
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
Less
More
- Posts: 267
- Thank you received: 42
08 Sep 2015 19:22 #62253
by racedirector
Basically it was groups of states and inputs ANDed or ORed together to give a result to the timer or timers associated with it. Some groups had a couple of timers doing different pulses which again were ANDed together to the output pin. it looked damn confusing and admittedly it was confusing at time as Mach ran down the groups constantly so you had to make sure that one group didn't change the next and screw things up.
Replied by racedirector on topic Turning an output on and off...
Forgot to answer this bit...It sounds like you had a moderately complicated set of inputs to control the flash sequence?
Basically it was groups of states and inputs ANDed or ORed together to give a result to the timer or timers associated with it. Some groups had a couple of timers doing different pulses which again were ANDed together to the output pin. it looked damn confusing and admittedly it was confusing at time as Mach ran down the groups constantly so you had to make sure that one group didn't change the next and screw things up.
Please Log in or Create an account to join the conversation.
Time to create page: 0.080 seconds