Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: naveenkumarm.ece on November 23, 2013, 02:35:54 AM
-
HI
Below I mentioned the vb script i used in macropump. It starts homing my axis when i press reset button. But I want my machine to do the homing function only once when i press the Reset button. Since, I used a Macropump it continuously executes the code again and again until i press the reset button again. Can anyone help me in this. Thank you.
'power on the optical home detector and wait 500 ms before homing
ActivateSignal(Output3)
Sleep (500)
' home 3 axis
DoButton(24)
DoButton(23)
DoButton(22)
DeactivateSignal(output3)
x=getuserdro(1000) 'each input has its on dro Input1 is a physical button
If GetInput(1) And x=0 Then 'comming off the modbus but any input can be used here
SetUserDRO(1000,1) 'counter dro
DoOEMButton(*********) 'button pushed on
End If
If Not(GetInput(1)) And x>0 Then
SetUserDRO(1000,0)
DoOEMButton(*********) 'button pushed again for off
End If
-
please understand i'm new at this.
but.. i think you need to change
If Not(GetInput(1)) And x>0 Then
to
If Not(GetInput(1)) And x=1 Then