If you have a common/interesting ladder program please add it.
if you need help adding it or help creating a special ladder program
Contact me Chris Morley c/o the EMC users maillist-I'll try to help
They may or may not be actually tested with hardware.
Ins spindle orient complete magazine in spindle unclamp magazine down magazine up spindle clamped magazine out counter switch tool 1 position switch(for homing purposes) Outs orient spindle magazine in (remove power and the magazine will move out) unclamp spindle (remove power and the spindle will clamp) lower magazine (remove power and the magazine will go up) rotate magazine cw rotate ccw
In your ini file under [HALUI] you add MDI_COMMAND = G38.2 Z-3 F16 and MDI_COMMAND = G92 z .250 and MDI_COMMAND -G0 z 1
The logic goes like this when the PYVCP button is on and emc is in MDI mode and %B0 and %B1 are not on set %B0 output on. %B0 and %B1 outputs represent procedure steps.
Next line when B0 turns on a monostable holds the signal on for 500 ms which turns on Q0 (which connects to HALUI MDI command 0-G38.2 z-3 f16 -probe down in z at feed rate 16 till contact is made)
Next line: When %B0 is on (step 0 is active) and %I2 (in position signal-means probe is done.) goes off-to-on then set %B1 (step 1) on.
Next line: When %B1 is on, turn on a monostable for 500 ms that holds %Q1 on (%Q1 controls MDI command G92 .250 set offset so z = zero at the bottom of the .250 thick plate )also a timer is set to run.
When the timer is done use a monostable to hold %Q2 on for 500 ms (MDI command Go z 1 -rapid away from plate) and reset %B1 (step1 done)& %B0 (step0 done).
The timer is used to make sure the last rapid command is actually last-there isn't a pin to tell you when the G92 command has finished.
Here is a link to the thread http://www.cnczone.com/forums/showthread.php?t=62423 Below is what one user used for a touch-off plate. Here is the Video...http://www.youtube.com/watch?v=QYBAH6E8IZs
If used on EMC 2.3.X a pin name needs to be changed: moton.motion-inpos to motion.in-position
Also, The timer block has changed in 2.3. The block has 4 pins labled E,C,D,R. Pins C and E must be connected together as noted here: http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?UPDATING#Classicladder_changes
| This is the ladder program for the THC plasma config example in EMC2 It was created using Trunk from circa pre EMC 2.1/classicladder 7.100 (text and drawing snipped/borrowed from another wiki page) see: http://wiki.linuxcnc.org/uploads/dallur-thc-design.txt for full txt | |
There are 3 rungs in this ladder, the first one is the state-aware estop with external triggers, this circuit is just a slightly modified example from the classicladder example, see: http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Sample_HAL_And_ClassicLadder
Rung 1 The only difference from the example is the addition of B0 which is a signal to enable rung 3 to trigger an estop
Rung 2 is used to control the LockPierceHeight? (Q7) and MoveZtoPierceHeight?(Q8), the first circuit is activated by the SpindleON/TorchON? (I5) request from the user or gcode, next we check if the FloatSwitch? is on because the only time we want to LockPierceHeight? and MoveZtoPierceHeight? is when the float switch has been triggered. If LockPierceHeight? is already active we know that the FloatSwitch? has been triggered since SpindleON/TorchON?(I5) was last set so we can bypass the FloatSwitch? (I3) check. However we only want to do this for the first time the FloatSwitch? is triggered so we put in a timer which is not reset until the I5 or I3 signals are reset with a bypass that retains the circuit for as long as MoveZtoPierceHeight? (Q8) is active, MoveZtoPierceHeight? is disconnected as soon as TorchIsAtPierceHeight? (I7) is true, TorchIsAtPierceHeight? is external to the ladder but it is a compare (comp) which is true if the CurrentPosition? is >= PierceHeight?. LockPierceHeight? (Q7) is set to active every time the circuit is activated, the second circuit then deactivates LockPierceHeight? (Q7) when ever SpindleON/TorchON? I5 is turned off.
To recap, If TorchON? requested and FloatSwitch? Active or LockPierceHeight? active MoveZtoPierceHeight? until TorchIsAtPierceHeight? then LockPierceHeight? stays active until TorchOFF? at which time it is tuned off.
Rung 3 is used to control moveZtoFloat? (Q3), moveZtoSafe? (Q4), feed-hold (Q6) and turn_torch_on (Q5). The first circuit is used to determine if the mode is manual or auto, if automatic mode is on it means we are running gcode and in that scenario we want to move the Z torch to a safe location when SpindleON/TorchON? (I5) is not being requested, the main purpose of this is to keep the torch safe when moving it around so it will not run into uneven surfaces. The second circuit is a bit complex due to the nature of the initialization sequence.
Branch 1 If SpindleON/TorchON? (I5) is requested and ArcOK?(I4) activate feed-hold (Q6) until the PierceDelay?(I8)* timer is up. We want to hold the gcode execution until the pierce timer is elapsed and we have pierced through the material.
Branch 2 If SpindleON/TorchON? (I5) on requested and If ArcOK? is is false we activate feed-hold(Q6), reset moveZtoSafe? (Q4) to disable it, and activate moveZtoFloat? (Q3) until float-switch (I3) is on activated. If TorchIsAtPierceHeight? (I7) becomes true it will activate turn_torch_on (Q5) which will open up an alternative path so it will remain open until SpindleON/TorchON? (I5) turns off.
Branch 3
If SpindleON/TorchON? (I5) is requested and if turn_torch_on (Q5) is active we start a timer set by the ArcStartTimeout?(I9)*, if at any point ArcOK?(I4) turns off after the time is up we activate B0 which causes an ESTOp in Rung1.
* Impossible to implement at this time due to limitations in classicladder, has to be edit manually in ladder

These two panels show the main ladder program the one on the left sends the signals (through HAL s32 pins ) to STEPGEN for forward and backward depending on which sequential step is active.
The %X bit inputs tell you when a step is active or not.The tool number is output to a word memory variable 'TOOL#' ( %W11 ). The %B10 switch is a momentary switch to start the index process.
The one on the right shows a counter to keep track of the current tool number. When the tool number = 4 the counter is reset to 0 again (so tool numbers are 0-3)
On the left is the subroutine. This checks to see if the commanded move is the same as the current position, if it is then sets the temporary holding register to the current position and finally lets the next step become active depending on what step was currently active.
On the right is the signed integers window, showing the current, commanded , hold register and the current tool number. The 'current' position is imported from STEPGEN through a s32 input pin. The 'commanded' is exported through a s32 out pin which is converted to a float signal and sent to STEPGEN. The 'hold register' and 'tool number' are held in temporary internal memory.
On the left shows how I filled out the SYMBOLS window to get named variables. It also shows the HAL signals connected to them.
On The right shows the HAL file used to test this program which didn't use EMC . One thing to Note was that STEPGEN's commanded position information is on a FLOAT pin and Classicladder cannot write (or read) them, so it has to be converted first, using HAL's conv_s32_float component.