CL logic to make LCNC buttons work like industrial machines
- The Feral Engineer
-
Topic Author
- Offline
- Senior Boarder
-
- Posts: 74
- Thank you received: 17
I work for a global machine tool builder in applications engineering and have a 26 year background in machining with 21 years in CNC machining and 16 as an AE - with a primary focus on teaching customers how to set up, program and operate equipment. I don't have a ton of time behind the wheel of LCNC, but have learned enough of HAL and Classicladder to begin sharing my findings via youtube tutorial videos that people have found to be useful, so I wanted to start sharing on here as well.
I built a classicladder configuration tonight that handles start, pause, resume and single step more like an industrial CNC machine. I.E. cycle start, feed hold and single block toggle, where cycle start commands single block when engaged.
I use a PS3 controller as an MPG and have used it as the primary focus of my tutorial videos, but have also began incorporating physical buttons into my CL file to respond the same way with the intention of using two analog inputs on my 7i76e for rapid and feed override (I have a deadman circuit on my PS3 control for spindle override) as well as, you guessed it, a physical cycle start, feed hold and single block button.
my other ladder project was a gladevcp parts counter that interacts with classicladder and will allow you to set a max count and let the machine run until that count is reached, then stop automatically.
I hope you find this useful. Ladder circuit as attachment
#classicladder start/stop
net auto-mode classicladder.0.in-00 input.0.btn-tr2
net feed-hold classicladder.0.in-01 input.0.btn-tl2
net program-idle classicladder.0.in-02 halui.program.is-idle
net single-block classicladder.0.in-03 input.0.btn-x
net auto-mode-select classicladder.0.out-00 halui.mode.auto
net cycle-start classicladder.0.out-01 halui.program.run
net feed-hold-select classicladder.0.in-04 classicladder.0.out-02 halui.program.pause
net feed-resume classicladder.0.out-03 halui.program.resume
net single-block-select classicladder.0.out-04 halui.program.step
net feed-is-pause classicladder.0.in-05 halui.program.is-paused
Attachments:
Please Log in or Create an account to join the conversation.
Thank you for sharing your work here.
It would be nice it linuxcnc actual had a proper single step and block delete worked properly.
IIRC pilot path did some single step work - I wonder if the code is transferable.
The great thing about linuxcnc is there is usually a away around a problem - it's so flexible.
Please Log in or Create an account to join the conversation.
- The Feral Engineer
-
Topic Author
- Offline
- Senior Boarder
-
- Posts: 74
- Thank you received: 17
I've put up 9 videos in the last 11 days. I needed a break tonight, but really wanted to make the single block/cycle start/feed hold thing work, which it seems to be. I don't use a lot of block skip, even on the industrial machines (except extended block skip /2 to toggle bar feeders for new bar, which is handled by the PLC), so I haven't really noticed the limitation with it just yet. I've actually spent probably 100 times more hours hammering away at HAL/CL than I have actually running my machines, to be quite honest. I'll be uploading a build video of my SX3 mini mill pretty soon as well

I actually commented again on the one video recently when I realized who you were after perusing here a little more. I was using that gmoccapy turtle jog thing you mentioned on my logitech game controller for a while and just last night applied it to a toggle.0.in/out to make it stick, which works well. I did a side by side comparison of and/or/xor plc logic and and2/or2/xor2 hal and while I prefer to do those in CL, I much prefer toggle.0 over writing plc for it. I do love how they play together in the same sandbox, though

Please Log in or Create an account to join the conversation.
CL was the first project I worked on in linuxcnc.
I updated the version to 7.124 I think and tried to add some useful stuff.
If you like ladder programming it pretty nice.
I could never figure out ethernet modbus though.
Have a Happy New Year!
Please Log in or Create an account to join the conversation.
- The Feral Engineer
-
Topic Author
- Offline
- Senior Boarder
-
- Posts: 74
- Thank you received: 17
Haven't tried grafcet. I downloaded the standalone classicladder for windows (was playing around with it on my work computer) and I liked the added features of the newer update. The one running in lcnc needs a bit of a facelift - or at least the ability to copy/paste or at least shift lines down instead of having to recreate lines when you forget to add space for your or circuit
Happy new year, sir. Enjoy it!
Please Log in or Create an account to join the conversation.
- Mike_Eitel
-
- Offline
- Platinum Boarder
-
- Posts: 1144
- Karma: 3
- Thank you received: 179
Mike
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Boarder
-
- Posts: 4372
- Karma: 148
- Thank you received: 1003
Please Log in or Create an account to join the conversation.
I believe it did have coping available.
But yes CL is highly modified.
Eventually it will need to be updated as GTK2 (CL uses it for display( will be unavailable
Please Log in or Create an account to join the conversation.
Mike_Eitel wrote: It's not realy fun or easy, but you can "patch" in the cpl file via an editor and insert, delete ore even move rungs.
Mike
Have you done this and could supply the changes?
Chris
Please Log in or Create an account to join the conversation.
cmorley wrote:
Mike_Eitel wrote: It's not realy fun or easy, but you can "patch" in the cpl file via an editor and insert, delete ore even move rungs.
Mike
Have you done this and could supply the changes?
Chris
Or do you mean edit the CL _ladder_ programs by hand?
Please Log in or Create an account to join the conversation.