Machine warning lights (Red, Amber, Green)

More
9 years 9 months ago #86011 by Todd Zuercher
Andy would win hands down. (he wrote the hardware interface driver for my first Linuxcnc machine, and helped walk me through setting it up.)

All I'm good for is the occasional bit of hal setup or ladder logic. A programmer I am not.

Please Log in to join the conversation.

More
3 years 1 month ago #281540 by camb0
If anyone is following this thread I did it in HAL, it was actually quite easy, here's the config:
Put this in your main hal file
Code:
# Load classic ladder loadrt classicladder_rt numPhysInputs=15 numPhysOutputs=15 numS32in=10 numS32out=10 numFloatIn=10 numFloatOut=10 numBits=50 numWords=50 addf classicladder.0.refresh servo-thread # TODO switch back to this later loadusr classicladder --nogui custom.clp loadusr classicladder custom.clp

Then in your post_gui (as you'll need some of the pins that load).
Note that pdnt pins are for my pendant the general lines are above but commented out:
Code:
########### SETUP THE MACHINE LIGHT ######### # Turn on the machine light to red to kick things off. setp hm2_7i96s.0.7i76.0.1.output-12 true net greenlight hm2_7i96s.0.7i76.0.1.output-10 classicladder.0.out-02 net yellowlight hm2_7i96s.0.7i76.0.1.output-11 classicladder.0.out-01 net redlight hm2_7i96s.0.7i76.0.1.output-12 classicladder.0.out-00 net e-stop halui.estop.is-activated classicladder.0.in-00 #net pwr-on halui.machine.is-on classicladder.0.in-01 net machine.is-on classicladder.0.in-01 #net prg-run halui.program.is-running classicladder.0.in-02 net pdnt.program-is-running halui.program.is-running classicladder.0.in-02 #net halui.program.is-idle classicladder.0.in-03 net pdnt.program-is-idle classicladder.0.in-03



The classic ladder file is attached. 

Attachment not found

Please Log in to join the conversation.

More
2 years 2 weeks ago #311847 by cnctrucker

Please Log in to join the conversation.

More
2 years 2 weeks ago #311848 by cnctrucker

If you are not already using ClassicLadder, and don't want to bother adding it, it can all be done in hal as well.

I think I'd attack this something like this.
Code:
loadrt and2 count=2 loadrt xor2 count=1 loadrt siggen num_chan=1 addf and2.0 servo-thread addf and2.1 servo-thread addf xor2.0 servo-thread addf siggen.0.update servo-thread setp siggen.0.frequency 2 #Yellow Light net yellow-in1 <= halui.machine.is-on => and2.0.in0 net yellow-in2 <= halui.program.is-idle => and2.0.in1 net yellow-out <= and2.0.out net yellow-out => hm2_7i76e.0.7i76.0.0.output-01 #(or what ever your output pin is for the yellow light) #Green Light net green-in1 <= halui.program.is-running => xor2.0.in0 net green-in2 <= halui.program.is-paused => and2.1.in1 net flash <= siggen.0.clock => and2.1.in0 net green-flash <= and2.1.out => xor2.0.in1 net green-on <= xor2.0.out => hm2_7i76e.0.7i76.0.0.output-02 #Red Light net red-on <= halui.estop.is-activated => hm2_7i76e.0.7i76.0.0.output-00 #(or what ever your output pin is for the red light) (I just have a big red light on each of our machines that turns on when they are not running a program.)  

 

I have a question which may be version related.  This line:
net yellow-in1 <= halui.machine.is-on => and2.0.in0
gives me the error:
/usr/share/linuxcnc/hallib/qtplasmac_comp.hal:21: Pin 'halui.machine.is-on' was already linked to signal 'yellow-in1'
when I try to run this in version 2.9.3

Could anyone give me some insight into why, and maybe a way to make it work?  I am a total newbie at HAL coding.

Please Log in to join the conversation.

More
2 years 2 weeks ago #311850 by Aciera
The error appears because you are reassigning 'halui.machine.is-on' to a signal (even though it is the same one).

change:
Code:
net yellow-in1 <= halui.machine.is-on => and2.0.in0

to:
Code:
net yellow-in1 => and2.0.in0

Please Log in to join the conversation.

More
2 years 2 weeks ago #311851 by cnctrucker

The error appears because you are reassigning 'halui.machine.is-on' to a signal (even though it is the same one).

change:
Code:
net yellow-in1 <= halui.machine.is-on => and2.0.in0 to: [code]net yellow-in1 => and2.0.in0
[/code]
 

Hmmm... my question would be is, how would I input the machine power state into the and2.0.in0 and the machine idle state into the and2.in1?
Code:
#Yellow Light net yellow-in1 <= halui.machine.is-on => and2.0.in0 # Checks that the machine is on net yellow-in2 <= halui.program.is-idle => and2.0.in1 # Checks that the machine is idle net yellow-out <= and2.0.out # Yellow light is either lit or not, depending on the machine idle state. net yellow-out => parport.0.pin-17-out #(or what ever your output pin is for the yellow light)

Wouldn't I have to be able to get the signal from halui.machine.is-on and halui.program.is-idle into the and2 inputs to accomplish the desired output?

I would also be faced with a similar issue in the subsequent code block:
Code:
#Green Light net green-in1 <= halui.program.is-running => xor2.0.in0 net green-in2 <= halui.program.is-paused => and2.1.in1 net flash <= siggen.0.clock => and2.1.in0 net green-flash <= and2.1.out => xor2.0.in1 net green-on <= xor2.0.out =>parport.0.pin-17-out

The intent in this block is that if the machine is running, the green light is solid; if the program is paused, then it is flashing.

Not sure I see the connections here with your suggestion -- could you maybe explain the logic a little?
 

Please Log in to join the conversation.

More
2 years 2 weeks ago #311853 by Aciera
Please post your hal file so we are on the same page.

Please Log in to join the conversation.

More
2 years 2 weeks ago #311879 by cnctrucker

Please post your hal file so we are on the same page.
 


As requested.  I have 5 status LEDs on the face of the control box; I am trying to light them to reflect the status of the machine.  The machine itself works perfectly -- it is the status light code that I am having trouble with.
Code:
# Generated by stepconf 1.1 at Tue Oct  8 18:45:41 2024 # If you make changes to this file, they will be # overwritten when you run stepconf again loadrt [KINS]KINEMATICS loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=[TRAJ]SPINDLES loadrt hal_parport cfg="0xd010 out 0xb010 in" setp parport.0.reset-time 2000 loadrt stepgen step_type=0,0,0,0 # # Uncomment next 4 lines for classicladder version of machine lights in custom_postgui.hal # Load classic ladder # loadrt classicladder_rt numPhysInputs=15 numPhysOutputs=15 numS32in=10 numS32out=10 numFloatIn=10 numFloatOut=10 numBits=50 numWords=50 # addf classicladder.0.refresh servo-thread # loadusr classicladder --nogui custom.clp # START CODE: Trying pure hal version of machine lights loadrt and2 count=2 loadrt xor2 count=1 loadrt siggen num_chan=1 addf and2.0 servo-thread addf and2.1 servo-thread addf xor2.0 servo-thread addf siggen.0.update servo-thread setp siggen.0.frequency 2 #Yellow Light net yellow-in1 <= halui.machine.is-on => and2.0.in0 net yellow-in2 <= halui.program.is-idle => and2.0.in1 net yellow-out <= and2.0.out net yellow-out => parport.1.pin-16-out #Green Light net green-in1 <= halui.program.is-running => xor2.0.in0 net green-in2 <= halui.program.is-paused => and2.1.in1 net flash <= siggen.0.clock => and2.1.in0 net green-flash <= and2.1.out => xor2.0.in1 net green-on <= xor2.0.out => parport.0.pin-17-out #Red Light net red-on <= halui.estop.is-activated => parport.0.pin-16-out # END CODE: Trying pure hal version of machine lights loadrt lut5 loadrt  plasmac addf parport.0.read base-thread addf parport.1.read base-thread addf stepgen.make-pulses base-thread addf parport.0.write base-thread addf parport.0.reset base-thread addf parport.1.write base-thread addf stepgen.capture-position servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf plasmac servo-thread addf stepgen.update-freq servo-thread # ---PLASMA INPUT DEBOUNCE--- loadrt dbounce names=db_breakaway,db_float,db_ohmic,db_arc-ok addf db_float     servo-thread addf db_ohmic     servo-thread addf db_breakaway servo-thread addf db_arc-ok    servo-thread # ---JOINT ASSOCIATED WITH THE Z AXIS--- net plasmac:axis-position joint.3.pos-fb => plasmac.axis-z-position # ---PLASMA INPUTS--- # ---all modes--- net plasmac:float-switch   => db_float.in net plasmac:breakaway      => db_breakaway.in net plasmac:ohmic-probe    => db_ohmic.in net plasmac:ohmic-sense-in   => plasmac.ohmic-sense-in # ---modes 0 & 1 net plasmac:arc-voltage-in => plasmac.arc-voltage-in # ---modes 1 & 2 net plasmac:arc-ok-in      => db_arc-ok.in # ---mode 2 net plasmac:move-up        => plasmac.move-up net plasmac:move-down      => plasmac.move-down # ---PLASMA OUTPUTS--- # ---all modes--- # net plasmac:ohmic-enable   <= plasmac.ohmic-enable # net plasmac:scribe-arm     <= plasmac.scribe-arm # net plasmac:scribe-on      <= plasmac.scribe-on # ---ARC VOLTAGE ENCODER--- loadrt encoder num_chan=1 addf encoder.update-counters base-thread addf encoder.capture-position servo-thread setp encoder.0.counter-mode 1 setp encoder.0.position-scale 1 net plasmac:arc-voltage-raw encoder.0.phase-A net plasmac:arc-voltage-in encoder.0.velocity net estop-out       => parport.0.pin-01-out net xstep           => parport.0.pin-02-out setp parport.0.pin-02-out-reset 1 net xdir            => parport.0.pin-03-out net ystep           => parport.0.pin-04-out setp parport.0.pin-04-out-reset 1 net ydir            => parport.0.pin-05-out net zstep           => parport.0.pin-06-out setp parport.0.pin-06-out-reset 1 net zdir            => parport.0.pin-07-out net y2step          => parport.0.pin-08-out setp parport.0.pin-08-out-reset 1 net y2dir           => parport.0.pin-09-out setp parport.0.pin-14-out-invert 1 net plasmac:torch-on => parport.0.pin-14-out net plasmac:arc-voltage-raw <= parport.0.pin-10-in net plasmac:arc-ok-in <= parport.0.pin-11-in-not net plasmac:float-switch <= parport.0.pin-12-in-not net estop-ext       <= parport.0.pin-13-in net min-home-x      <= parport.1.pin-02-in net max-x           <= parport.1.pin-03-in net min-home-y      <= parport.1.pin-04-in net max-y           <= parport.1.pin-05-in net min-home-z      <= parport.1.pin-06-in net max-z           <= parport.1.pin-07-in net min-home-y2      <= parport.1.pin-08-in net max-y2           <= parport.1.pin-09-in setp lut5.0.function 0x10000 net all-limit-home => lut5.0.in-4 net all-limit <= lut5.0.out net xhoming <= joint.0.homing => lut5.0.in-0 net yhoming <= joint.1.homing => lut5.0.in-1 net y2homing <= joint.2.homing => lut5.0.in-2 net zhoming <= joint.3.homing => lut5.0.in-3 setp stepgen.0.position-scale [JOINT_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 70000 setp stepgen.0.dirsetup 150000 setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb net xstep <= stepgen.0.step net xdir <= stepgen.0.dir net xenable joint.0.amp-enable-out => stepgen.0.enable net min-home-x => joint.0.home-sw-in net min-home-x => joint.0.neg-lim-sw-in net max-x => joint.0.pos-lim-sw-in setp stepgen.1.position-scale [JOINT_1]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 70000 setp stepgen.1.dirsetup 150000 setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL net ypos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd net ypos-fb stepgen.1.position-fb => joint.1.motor-pos-fb net ystep <= stepgen.1.step net ydir <= stepgen.1.dir net yenable joint.1.amp-enable-out => stepgen.1.enable net min-home-y => joint.1.home-sw-in net min-home-y => joint.1.neg-lim-sw-in net max-y => joint.1.pos-lim-sw-in setp stepgen.2.position-scale [JOINT_2]SCALE setp stepgen.2.steplen 1 setp stepgen.2.stepspace 0 setp stepgen.2.dirhold 70000 setp stepgen.2.dirsetup 150000 setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL net y2pos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd net y2pos-fb stepgen.2.position-fb => joint.2.motor-pos-fb net y2step <= stepgen.2.step net y2dir <= stepgen.2.dir net y2enable joint.2.amp-enable-out => stepgen.2.enable net min-home-y2 => joint.2.home-sw-in net min-home-y2 => joint.2.neg-lim-sw-in net max-y2 => joint.2.pos-lim-sw-in setp stepgen.3.position-scale [JOINT_3]SCALE setp stepgen.3.steplen 1 setp stepgen.3.stepspace 0 setp stepgen.3.dirhold 70000 setp stepgen.3.dirsetup 150000 setp stepgen.3.maxaccel [JOINT_3]STEPGEN_MAXACCEL net zpos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd net zpos-fb stepgen.3.position-fb => joint.3.motor-pos-fb net zstep <= stepgen.3.step net zdir <= stepgen.3.dir net zenable joint.3.amp-enable-out => stepgen.3.enable net min-home-z => joint.3.home-sw-in net min-home-z => joint.3.neg-lim-sw-in net max-z => joint.3.pos-lim-sw-in net estop-out <= iocontrol.0.user-enable-out net estop-ext => iocontrol.0.emc-enable-in net tool-number <= iocontrol.0.tool-prep-number net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

 

Please Log in to join the conversation.

More
2 years 2 weeks ago #311934 by Aciera
The conflict is between your halfile and 'hallib/qtplasmac_comp.hal':

/usr/share/linuxcnc/hallib/qtplasmac_comp.hal:21: Pin 'halui.machine.is-on' was already linked to signal 'yellow-in1'


Your halfile seems to get called first and 'halui.machine.is-on' is connected to the signal 'yellow-in1'. Then 'qtplasmac_comp.hal' is loaded and it wants to assign the same pin to a different signal which causes the error.

Open '/usr/share/linuxcnc/hallib/qtplasmac_comp.hal' and see which signal name it wants to connect 'halui.machine.is-on' to and use that signal in your halfile:

Change:
Code:
net yellow-in1 <= halui.machine.is-on => and2.0.in0

To:
Code:
net <signalname from qtplasmac_comp> => and2.0.in0

Please Log in to join the conversation.

Time to create page: 0.076 seconds
Powered by Kunena Forum