Implement IO judgment in NGC files?

More
02 Mar 2022 03:26 #236153 by chen1234
I've been having trouble writing G-code recently and was hoping someone could give me some hints.
I need to implement IO judgment in a .ngc file, such as the function of M66, but it can be implemented directly in G code
test.ngc:
...
if M101 == ture
...
Is there a way to program it directly in the NGC file?

 

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

More
02 Mar 2022 07:12 #236156 by MaHa
You can use this in a ngc file
M66 P1 L0
#<ABC> = #5399
   o803 IF     [#<ABC> EQ 1]
             ......
   o803 ENDIF
The following user(s) said Thank You: chen1234

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

More
02 Mar 2022 08:11 - 02 Mar 2022 08:12 #236157 by chen1234
thanks,MaHa
I have other little questions
How many pins can M66 define? I see in the documentation that there are 3 each for digital and analog signals, is there any way to expand this number?
Or how to combine this function with PLC?
Last edit: 02 Mar 2022 08:12 by chen1234.

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

More
02 Mar 2022 08:40 #236158 by andypugh
You can increase the io using the "num_dio" parameter to the "loadrt motmod" command.

Depending on the structure of your HAL / INI files this might need to be done either as a change to the HAL file, or to a parameter read in to the HAL from the INI.

linuxcnc.org/docs/2.8/html/man/man9/motion.9.html
The following user(s) said Thank You: chen1234

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

More
02 Mar 2022 08:41 #236159 by MaHa
In checked my config, end of this line the amount of  analog and digital inputs are set, if you need more than available by default.
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_aio=16 num_dio=8

I have used this only from hal
net cb11      pyvcp.checkbutton11   motion.digital-in-01
The following user(s) said Thank You: chen1234

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

More
02 Mar 2022 08:53 #236160 by chen1234
Thanks ,andy, MaHa
I will try to expand the number of IOs.
I have a new question, I want to add PLC function, how can this PLC be used with M66?

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

More
02 Mar 2022 14:03 #236175 by andypugh
A real PLC or a soft PLC (ie, ClassicLadder)?

I think that you would connect the PLC inputs and outputs to the same motion pins that you are already using, in the HAL layer.

linuxcnc.org/docs/2.8/html/ladder/ladder-intro.html
The following user(s) said Thank You: chen1234

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

Time to create page: 0.086 seconds
Powered by Kunena Forum