- Posts: 27
- Thank you received: 0
Reading value of pin in g code
I tried with:
I got this error:
Unknown word where unary operation could be
Please Log in to join the conversation.
Firstly, to check for equality in G-code you have to use "EQ"
O100 IF [#124 EQ 100]
Do Stuff
O100 ENDIF
linuxcnc.org/docs/2.7/html/gcode/overvie...ode:binary-operators
It is possible to read HAL pins in G-code, but the feature needs to be turned-on.
linuxcnc.org/docs/2.7/html/remap/remap.h...i_file_configuration
I wouldn't recommend doing that in this case, though. The problem is that the values are read at preview-time, not at run-time. This could cause unexpected results.
Much better to "net" the classicladder pin to one of the G-code digital input pins and use M66 to read it.
linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m66
Please Log in to join the conversation.
My unfortunately bad ideas ....
also try with GOTO.. here is one of my bad codes..
bad character n used
Please Log in to join the conversation.
Radek wrote: I knew this comands, but i can't use it properly.
The key is the phrase "The current value of the input is stored in parameter #5399"
Though normally you don't need to check the value as you use it in a "wait for state" mode and just need to check for timeout.
Please Log in to join the conversation.
Ok... shit happens.. it's not working
Please Log in to join the conversation.
Radek wrote: Ok, but now i want to back to 1st line of programme. What command should i use? GOTO ?
Do you want it to run for ever?
There is no GOTO in G-code:
linuxcnc.org/docs/2.7/html/gcode/o-code.html
Please Log in to join the conversation.
Please Log in to join the conversation.
Radek wrote: I got while loop, but i need also if but it doesn't work.. are there any mistakes in my code ?
Well, the command "Do Stuff" if it is literally in the code won't help.
By default there are only 4 digital input pins, so your P11, P12, P13 are likely to cause trouble.
Please Log in to join the conversation.
andypugh wrote:
Radek wrote: I got while loop, but i need also if but it doesn't work.. are there any mistakes in my code ?
Well, the command "Do Stuff" if it is literally in the code won't help.
By default there are only 4 digital input pins, so your P11, P12, P13 are likely to cause trouble.
this is my code... While is working properly, but if not. Why? I want also to back to the 1st line of programme after endif.
Attachment not found
Please Log in to join the conversation.
