Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: magnetron on October 03, 2016, 08:08:12 AM
-
hello dear forum,
I want use M6start.ms1 to control MODBUS PLC to change tool in the CNC machine
the macro is as following
-------------------------------------------------
tool = GetSelectedTool()
ActivateSignal(OUTPUT3)
Code "G4 P5"
While IsMoving()
Wend
DeactivateSignal(OUTPUT3) 'Engage Turret holding pin
SetCurrentTool(tool)
SystemWaitFor GetOEMLED(1000)
--------------------------------------------
in the brain control I get an input from MODBUS PLC to OEMLED(1000)
it is activated as you can see in following picture
(https://s20.postimg.org/wygmkb2qx/mach3brain.jpg) (https://postimg.org/image/wygmkb2qx/)
my question ;
why does not the macro end after seeing the OEMLED (1000 ) is 1 ?
the G-code program doesnot pass beyond the line " M6T04"
I can see the macro running until last line becouse I see OUTPUT3 turn on and off the LED in the MODBUS PLC
please advise
thank you
-
systemWaitFor waits on an input signal going active. getOEMLED returns a boolean. The integer casts of boolean are 0 and -1.
You are therefore waiting on either 0 or -1 depending on what getOEMLED returns when it's called. 0 is the DIGTRIGGER output and -1 doesn't exist as either an input or an output.
-
sorry my native language is not english
do you want to say that SystemWaitFor is used only with INPUT1 - INPUT4
is there no other signal to be used with SystemWaitFor ?
if yes what is the syntax ?
thank you
-
systemWaitFor works for ALL input signals. It has nothing to do with LED states.
-
neither SystemWaitFor (OEMTRIGGER1)
nor SystemWaitFor (OEMTRIGGER#1) works
I can see OEMTRIGGER1 turns green on in wiev brain
I assigned OEMTRIGGER1 to parallel port : 2 bit 0 and turned emulation on in port & pins
is there no manual with examples ?
-
OEMTRIGGER1 is not a valid signal name. It's OEMTRIG1.
see http://www.machsupport.com/Mach3Wiki/index.php?title=VB_Constants_for_Signal_Names for all the valid signal constants.
Also see http://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf
Note that the systemWaitFor documentation is wrong in that it says OUTPUTS where it should say INPUTS.