- Posts: 27
- Thank you received: 0
Reading value of pin in g code
9 years 7 months ago #90482
by Radek
Replied by Radek on topic Reading value of pin in g code
I solved the problem by using repeat loop. Now it's working correct but still have one problem
. In each if i want pick one more if to extend the programme but P66 always gives me high state which isn't true (checked in hal meter).
Here is my part of code: (o200 if doesn't work properly)
Here is my part of code: (o200 if doesn't work properly)
Code:
G91 G61
M66 P10 L3 Q99999999999 (czekanie na sygnal zjazdu)
G0 Z-50 (zjazd podajnika)
(msg, czekam na S)
o150 repeat [999]
M66 P11 L0
o110 if [#5399 EQ 1]
(msg, wykonuje prodecure dla klocka S)
M66 P00 L3 Q99999999999(czekanie na wozek)
G0 X-50 (podjazd wozka)
G4 P2 (ładowanie klocka)
G0 X50 (odjazd wozka)
M66 P01 L3 Q99999999999 (czekanie na czujnikS)
X100 (tasma S)
o200 if [#5399 EQ 1]
M66 P07 L0 (czekanie na sygnal rozladunku S)
G0 X150 (magazyn S)
X-150
X-100
o200 else
G0 X-100 (powrot wozka do poz. pocz.)
o200 endif
o110 endif
Please Log in to join the conversation.
9 years 7 months ago #90484
by andypugh
Replied by andypugh on topic Reading value of pin in g code
M66 P07 L0 (czekanie na sygnal rozladunku S)
Seems to be in the wrong place? (or, at least, the new #5399 value is never used)
Seems to be in the wrong place? (or, at least, the new #5399 value is never used)
Please Log in to join the conversation.
9 years 7 months ago #90487
by Radek
Replied by Radek on topic Reading value of pin in g code
So where it should be ?
Please Log in to join the conversation.
9 years 7 months ago #90489
by andypugh
Replied by andypugh on topic Reading value of pin in g code
I don't really follow what you are trying to do, so only you can answer that question really.
Please Log in to join the conversation.
9 years 7 months ago #90500
by Radek
Replied by Radek on topic Reading value of pin in g code
I'm sure that's in the correct place. The problem is that it executes if which doesn't perform conditions...
Please Log in to join the conversation.
9 years 7 months ago #90509
by andypugh
Replied by andypugh on topic Reading value of pin in g code
Your o200 IF is using the #5399 value from P01.
You never use the value read from P07
You never use the value read from P07
Please Log in to join the conversation.
9 years 7 months ago #90521
by Radek
Replied by Radek on topic Reading value of pin in g code
I swap lines if with M66 and it works.
Please Log in to join the conversation.
9 years 7 months ago #90623
by Sjdc1982
Replied by Sjdc1982 on topic Reading value of pin in g code
congrats,
but food for thought why not using a while or for loop instead of repeat.
my thought is with repeat is that if it works that it continues to do it over and over regardless.
using up a lot resources and maybe potential conflict...
i mean i could be wrong my programming language is limited to vba i used in autocad and excel...
but food for thought why not using a while or for loop instead of repeat.
my thought is with repeat is that if it works that it continues to do it over and over regardless.
using up a lot resources and maybe potential conflict...
i mean i could be wrong my programming language is limited to vba i used in autocad and excel...
Please Log in to join the conversation.
Time to create page: 0.058 seconds
