Implement IO judgment in NGC files?

More
4 years 7 months ago #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:
Code:
... if M101 == ture ...
Is there a way to program it directly in the NGC file?

 

Please Log in to join the conversation.

More
4 years 7 months ago #236156 by MaHa
You can use this in a ngc file
Code:
M66 P1 L0 #<ABC> = #5399    o803 IF     [#<ABC> EQ 1]              ......    o803 ENDIF

Please Log in to join the conversation.

More
4 years 7 months ago #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?

Please Log in to join the conversation.

More
4 years 7 months ago #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

Please Log in to join the conversation.

More
4 years 7 months ago #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.
Code:
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
Code:
net cb11      pyvcp.checkbutton11   motion.digital-in-01

Please Log in to join the conversation.

More
4 years 7 months ago #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 to join the conversation.

More
4 years 7 months ago #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

Please Log in to join the conversation.

Time to create page: 0.083 seconds
Powered by Kunena Forum