How many ladder programs at one time

More
18 Dec 2013 01:11 #41701 by JoeHildreth
Hello all,

I am trying to figure out classic ladder and the HAL stuff. I am starting to get a grip on it and I have a rather remedial question I suppose.

I used a website For Science Tutorial and this thread to add a pyvcp touchoff button to my configuration. It works fine and I have been using it to figure out CL. Now in this sample, stepgen created an empty custom.clp program and it is loaded into the userspace in the mymachine.hal file and the Touch off ladder is loaded in the custom.hal file.

When I bring up the ladder editor, it loads the touch off ladder only. So my question is:

Can you only run a single ladder program? Does the last one loaded win? Or am I not seeing custom.clp because it is an empty ladder program?

I have read over the docs a few times and I see nor refernce to being able to run only one ladder or multple ladders.

Thanks for your help.

Joe

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

More
18 Dec 2013 07:53 #41724 by BigJohnT
Good question, I think you can only have one ladder program running at a time but you can have multiple sections. Remember in ladder logic "last one wins" for outputs.

JT

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

More
18 Dec 2013 08:15 #41728 by JoeHildreth
That would definately explain what I am seeing. I guess that the custom.clp file is unloaded when the touchoff.clp file loads.

Thanks for the clarification Big John.

Joe

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

More
18 Dec 2013 15:27 #41741 by cmorley
Yes only one ladder real time instance allowed (in linuxcnc), and the real time instance can only load one program.
But as John said you can combine the programs in to one using sections.

Chris M
The following user(s) said Thank You: JoeHildreth

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

More
18 Dec 2013 21:33 #41760 by JoeHildreth
Chris,

Thanks for the info. Is it possible that the classic ladder docs could have a note added to them indicating that is how it works? That would make just one last thing a newbie like me has to try to figure out.

And after some thought on your reply, It makes sense that you would only want one real time ladder program running. Now one last remedial question. Do you want one function per section. (Say z-axis touch off in one section and some other functionality in another) or can they be programmed in one section? perhaps the z-axis touchoff takes two runs and some other feature takes three rungs all in the same section.

And something a little unrelated. Can logic (AND, OR, NAND, INVERT, etc) only be used in HAL?

Say I made a pendand with 8 buttons and they were binary coded to three input pins. I would use HAL do decode them to the proper signal in (3 to 8 decoder)

Thanks again for all your help. I appreciate it.

Joe

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

More
18 Dec 2013 22:25 #41762 by BigJohnT
Ladder is executed as follows
Update Inputs
Solve logic from top to bottom
Update Outputs

Sections make it easier to navigate if you have lots of rungs the sections are read in order. So if you only have 10 or 15 rungs it does not make sense to have sections.

The weighted sum component might be what you want to look at for your button logic.
www.linuxcnc.org/docs/html/man/man9/weighted_sum.9.html

A working example of wsum is here
gnipsel.com/linuxcnc/examples.html

And the man pages for all the components is here at the bottom of the page. Some will make sense like or2 is an or component etc and some you just have to open them up in the man page to see what it does.
www.linuxcnc.org/docs/html/

I can add a note to the docs.

JT
The following user(s) said Thank You: JoeHildreth

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

More
18 Dec 2013 23:00 - 18 Dec 2013 23:30 #41763 by JoeHildreth
Thanks for the information. I think you are correct in using the weighted sum. Although I want to look at your example in detail. This would be a bit easier than decoding the 3 bits to eight separate signals with discrete logic. Now admitting that I have not looked at the example, I am guessing the iinteger value generated by the weighted sum is attached to a HAL pin in some manner?

Again, thank you John for putting up with the green newbie!!!

Regards,

Joe H.

<EDIT>

Finished looking at your example. That seems pretty straight forward. Now if I am wanting to attach bits from a paralel port to the input of the weighted sum, I will do that in the custom.hal to prevent stepconf from blowing my work away correct? Also, I see you sent your output to a display. I could just as easily use the output from the weighted sum as an input in a ladder then do comparisons to activate the appropriate bit as an output.

This would then allow me to make a pendant with 15 buttons, encoded to four bits coming in, (for exmaple X+, X-, Y+, Y-, Z+, Z-, Z-touchoff, etc)
Use the weighted sum to give me the value of these bits as an integer
User ladder to evaulate the aforementioned output using comparisons to activate the requested pin, command, function (&c)

Is my reasoning sound. I have only been trying to learn this stuff for a couple of weeks so I may be way off base here.

Joe
Last edit: 18 Dec 2013 23:30 by JoeHildreth.

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

More
19 Dec 2013 00:57 #41775 by BigJohnT
Sounds like your getting a handle on LinuxCNC now.

JT

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

More
19 Dec 2013 01:35 #41779 by JoeHildreth
Thanks for the compliment John, but mostly, thaks for your direction and help. :-)

Joe

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

Time to create page: 0.082 seconds
Powered by Kunena Forum