CL logic to make LCNC buttons work like industrial machines

More
15 Jan 2021 18:10 #195473 by The Feral Engineer

This works fine.

net auto classicladder.0.in-00 pyvcp.run
net feed-hold classicladder.0.in-01 pyvcp.feedhold
net program-idle classicladder.0.in-02 halui.program.is-idle
net single-block classicladder.0.in-03 pyvcp.step
net mode:is:auto classicladder.0.in-04 halui.mode.is-auto
net btn-stop classicladder.0.in-05 pyvcp.stop

net auto-mode-select classicladder.0.out-00 halui.mode.auto
net cycle-start classicladder.0.out-01 halui.program.run
net feed-resume classicladder.0.out-03 halui.program.resume
net single-block-select classicladder.0.out-04 halui.program.step
net program-stop classicladder.0.out-05 halui.program.stop

net feed-hold-select classicladder.0.out-02 halui.program.pause


Hope you find it useful. I've got it working on my machine with no issues after a few minor adjustments :)
The following user(s) said Thank You: Sadmeatball

Please Log in or Create an account to join the conversation.

More
15 Jan 2021 18:14 - 15 Jan 2021 18:14 #195474 by The Feral Engineer

Make's sence to me.
If you are coming from standart automation world, plc programing is the absolute best way to go. C can only be acceptet for specialities. I f.x. dislike C as IT does not prevent me from my typos in concern of theses dam... ; 's. ;-()
Mike


I'm not a C programmer, I work for a machine tool company, so PLC is right up my alley. I actually switched to LCNC because it had an available PLC section (one of many reasons). I never spent much time writing my own logic, but I've had to troubleshoot it in the past, so I had a vague understanding of it - getting into writing my own circuits made it so much clearer :).

I've found a bit of a useful mid-ground between HAL and CL. The two tie together almost poetically.

as a PS, I find that loadrt toggle is a little easier on the eyes than a set/reset circuit in CL and loadrt multiswitch would be an absolute pain to write as ladder logic. It's very subjective :P
Last edit: 15 Jan 2021 18:14 by The Feral Engineer.

Please Log in or Create an account to join the conversation.

More
15 Jan 2021 19:36 #195482 by Mike_Eitel
To be honest:
I nearly hatte CL. There are so many easier ways in 61131 to write a Programm.
But you take what you get.. And once you get it running it's stable.
Mike

Please Log in or Create an account to join the conversation.

More
15 Jan 2021 19:47 #195486 by The Feral Engineer

To be honest:
I nearly hatte CL. There are so many easier ways in 61131 to write a Programm.
But you take what you get.. And once you get it running it's stable.
Mike


I like it. It almost feels like home to me. I cracked open the ladder on a machine at one of my customers the other day and I felt like I was wrapped in a warm blanket of logic. Plus, it kinda reassured me that I was pointed in the right direction. I only started having a crack at it about a month ago, but I learned so much in a very short time due in part to the fact that I wasn't completely green, I had a few ripe splotches to get me going :lol:

I'm going to be undertaking a retrofit project with my old vocational high school on a Fadal VMC15. The students in the pre-engineering and advanced manufacturing technology are learning PLC logic, hydraulics, pneumatics, etc. in the class, so they're going to tackle the electrical end and the students in machine tool tech (where the machine is located) can assist by machining adapter plates for everything once it all gets off the ground. My role is to kinda guide them along, introduce them to LCNC and have them apply their knowledge of AB plc to CL. Gives them a little insight on the similarities and differences of what they learn vs. what they'll apply after graduation. Should be interesting.

Please Log in or Create an account to join the conversation.

More
15 Jan 2021 21:45 #195489 by Mike_Eitel
Yes AB and Modicon have been the CL lovers.. But long times ago.
And yes u can also kind of CL in IEC61131. One of the 6-7 languages u can use.

Please Log in or Create an account to join the conversation.

More
15 Jan 2021 22:32 #195493 by The Feral Engineer

Yes AB and Modicon have been the CL lovers.. But long times ago.
And yes u can also kind of CL in IEC61131. One of the 6-7 languages u can use.


Fanuc and Mitsubishi still use plc ladder logic, so that's what I was most familiar with. My background is in Applications engineering, so I always spent most of my time in front of machines, teaching people how to use them. The backend stuff is still pretty new to me, but sadly, I think I've picked up more in the last 6 months than some of the dedicated service guys in my office know after 20 years in the industry :lol:

Please Log in or Create an account to join the conversation.

More
19 Oct 2021 03:48 - 20 Oct 2021 03:48 #223516 by spumco
[EDIT - I abandoned this in favor of the run/step scheme located in the HAL Examples sub-forum.  I'll come back to classic ladder once I've learned more about LCNC]

Thanks to the OP for posting this; I'd really like to have all my machines to act the same with cycle-start, feedhold, and single-block functions.

Unfortunately, I'm having some problems getting it working properly.  I'm sure I'm doing something wrong - i.e. new to LCNC and classicladder.

Anybody willing to have a shot at helping me troubleshoot this thing?  The ladder program starts & runs, and the cycle start button works.

Problem is that while I can see the single-block toggle in ladder, it doesn't seem to 'stick'.

Pressing cycle-start starts a program - OK
Pressing feedhold pauses the program - OK
Pressing feedhold again does not resume - not OK
Pressing cycle-start resumes the program

Restarting the program:
Pressing single-block and then pressing cycle-start starts the program and runs a single line, but a second cycle-start puts the program back in auto. not OK.  (single-block not persistent)

Pressing cycle-stop works OK

I've attached my version of the original .clp file and the pertinent sections of my hal file.  Note that I have to put all my net commands on two lines as dyslexia gets me if a net command has more than one thing on it.

#classicladder start/stop
net auto-mode           <=  [HMOT](CARD0).7i73.0.1.input-06-not #cyclestart
net auto-mode            =>  classicladder.0.in-00

net feed-hold           <=  [HMOT](CARD0).7i73.0.1.input-02-not #feedhold
net feed-hold           =>  classicladder.0.in-01

net program-idle        <=  halui.program.is-idle
net program-idle        =>  classicladder.0.in-02

net single-block        <=  [HMOT](CARD0).7i73.0.1.input-22-not #singleblock
net single-block        =>  classicladder.0.in-03

net mode-is-auto        <=  halui.mode.is-auto
net mode-is-auto        =>  classicladder.0.in-06

net btn-stop            <=  [HMOT](CARD0).7i73.0.1.input-04-not #cyclestop
net btn-stop            =>  classicladder.0.in-05

net auto-mode-select    <=  classicladder.0.out-00
net auto-mode-select    =>  halui.mode.auto

net cycle-start         <=  classicladder.0.out-01
net cycle-start         =>  halui.program.run

net feed-resume         <=  classicladder.0.out-03
net feed-resume         =>  halui.program.resume

net single-block-select <=  classicladder.0.out-04
net single-block-select =>  halui.program.step

net program-stop        <=  classicladder.0.out-05
net program-stop        =>  halui.program.stop

net feed-hold-select    <=  classicladder.0.out-02
net feed-hold-select    =>  halui.program.pause

Thanks,
Ralph
Attachments:
Last edit: 20 Oct 2021 03:48 by spumco.

Please Log in or Create an account to join the conversation.

More
25 Apr 2022 05:59 #241161 by The Feral Engineer
sorry for the late reply, just seeing this. i'll see if i can take a look at what you've got going on. 

as far as pressing feed hold again to resume, the whole purpose of my CL logic was to prevent this from happening. Feed hold should never resume motion, only cycle start. 

Please Log in or Create an account to join the conversation.

More
25 Apr 2022 20:08 #241248 by spumco
No worries - thanks for having a look.

Despite the 'edit' in my last update, I'm back to using the CL scheme above.  Seems to be working, more or less, but I haven't done tons of testing yet as I'm working on all the final retrofit punch-list stuff.

If you have a suggested edit I'm all ears, but I think my biggest complaint is that LCNC only pauses/steps at lines with motion.  M-codes, G4 pauses, etc. all get executed whenever a program is paused or being stepped through.

As I understand it, this is pretty-much hard-coded and not something simple to fix - and has nothing to do with your CL single-block 'mode' function.

Please Log in or Create an account to join the conversation.

More
27 Apr 2022 23:45 - 27 Apr 2022 23:46 #241418 by andypugh

As I understand it, this is pretty-much hard-coded and not something simple to fix - and has nothing to do with your CL single-block 'mode' function.



Indeed. There is no 1:1 link between G-code program lines and the elements in the realtime motion queue. Many codes simply set an internal G-code interpreter state, and nothing about them ends up in the motion queue until the next motion command is interpreted. 

Everything that is sent to the queue has an associated program line attached to it. But, taking the case of a standalone F command on a line of its own, that won't end up as an item on the queue (such as "STRAIGHT_FEED(........)" ) it will just be something that affects the parameters in the next STRAIGHT_FEED
Last edit: 27 Apr 2022 23:46 by andypugh.
The following user(s) said Thank You: spumco

Please Log in or Create an account to join the conversation.

Time to create page: 0.156 seconds
Powered by Kunena Forum