The code I have included is part of X & Y Zero.
When I use the debugger and step through the code, Dro(0) get set to zero. When I run the code, it does not get set to zero. I have tried Call SetDro and Code....
What am I doing wrong.
Thanks
Rem
Rem Test Code For X And Y Zero routine
Rem
XCurrent = GetDro(0) 'Get current X position
YCurrent = GetDro(1) 'Get current Y position
ZCurrent = GetDro(2) 'Get current Z position
FeedRateCurrent = GetOEMDro(818) 'Get the current Feed Rate
NewFeedRate = 10 'Set Feed Rate for macro
Call SetOEMDro(818, NewFeedRate)
Code "(Zero X and Y Macro Running)"
Rem Find the X negative
XNew = XCurrent - 2
Code "G31 X" &XNew
While IsMoving()
Wend
XPos1 = GetVar(2000)
Code "G0 X" &XCurrent
Rem Find the X positive
XNew = XCurrent + 2
Code "G31 X" &XNew
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2)/2
Code "G0 X" &XCenter
Code SetDro(0,0)