Reading value of pin in g code

More
27 Mar 2017 13:30 #90367 by andypugh
It can't be stopping at line 4. It is executing line 8.

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

More
27 Mar 2017 21:06 #90393 by Sjdc1982
just my two cents
but for me, i noticed when i tried to describe variables or use any of them i need to put them in this format
#<_variable>
or they won't work, IE maybe if you try
#<_4> = 0

(fyi i'm using nightly builds / pre releases as well and installed from the DVD image.)

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

More
27 Mar 2017 21:47 #90399 by andypugh
LinuxCNC supports two sorts of parameters (what might be called variables in an actual programming language, which G-code probably isn't).

#4 is a conventional mumerical parameter
#<myvariable> is a named parameter, an extension to the G-code standard supported by LinuxCNC
#<_myvariable> is a named paramter with global scope (which means that it has a value which can be used outside of the subroutine it is defined in)
#<4> is a named parameter. It will not necessarily have the same value as #4
#<_4> is another named parameter with global scope. It can have a different value to both #4 and #<4>

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

More
27 Mar 2017 22:35 #90402 by Sjdc1982
and my idea does nothing lol, sorry just spit balling thought it was a issue with values/params not communication inside...

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

More
28 Mar 2017 07:07 - 28 Mar 2017 07:19 #90419 by Radek

It can't be stopping at line 4. It is executing line 8.


Yes, you're right. I made a test, just left one if and programme missed this loop. It goes from 8th step to 30th... altough that P11=%Q11=s1 has a high state. What's wrong ?
Attachments:
Last edit: 28 Mar 2017 07:19 by Radek.

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

More
28 Mar 2017 09:04 #90423 by andypugh
Can you attach the G-code file, so far we have only seen it as a screen-shot.

Can you have a halmeter look at the actual value of motion.digital-in-11 (and 12, and 13) rather than assuming that the HAL net is working?

Did you increase the number of digital inputs in the loadrt motmod line?

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

More
28 Mar 2017 09:34 - 28 Mar 2017 09:36 #90424 by Radek
Hal meter shows that Q11 etc. is TRUE.
I changed L0 to L3 for some tests.

File Attachment:

File Name: hal.txt
File Size:2 KB

File Attachment:

File Name: postgui_hal.txt
File Size:2 KB

File Attachment:

File Name: ngc_2017-03-28.txt
File Size:1 KB
Attachments:
Last edit: 28 Mar 2017 09:36 by Radek.

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

More
28 Mar 2017 10:06 #90426 by andypugh
Can you insert a (debug, line-no #5399) before each "if" to see what the actual value being used is?

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

More
28 Mar 2017 10:16 - 28 Mar 2017 10:57 #90427 by Radek
I saw that when the 4th line is running then one of chosen pins P11,12,13 works correct, but only once and after this i can't do anything.
Attachments:
Last edit: 28 Mar 2017 10:57 by Radek.

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

More
28 Mar 2017 11:22 #90429 by Radek
That's how my code looks like at this moment. Loop works ONLY when the last step is running. It means that when line 23, 43, 62 is executed i need to set high state on P11,12 or 13 and then it works...

File Attachment:

File Name: ngc.txt
File Size:2 KB
Attachments:

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

Time to create page: 0.160 seconds
Powered by Kunena Forum