Hello Guest it is April 23, 2024, 08:26:48 PM

Author Topic: how to SystemWaitFor with OEMLED as input ?  (Read 4789 times)

0 Members and 1 Guest are viewing this topic.

how to SystemWaitFor with OEMLED as input ?
« 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




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

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: how to SystemWaitFor with OEMLED as input ?
« Reply #1 on: October 05, 2016, 11:52:36 AM »
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.
Re: how to SystemWaitFor with OEMLED as input ?
« Reply #2 on: October 06, 2016, 09:48:07 AM »
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

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: how to SystemWaitFor with OEMLED as input ?
« Reply #3 on: October 06, 2016, 11:06:35 AM »
systemWaitFor works for ALL input signals. It has nothing to do with LED states.
Re: how to SystemWaitFor with OEMLED as input ?
« Reply #4 on: October 06, 2016, 08:39:32 PM »
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 ?

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: how to SystemWaitFor with OEMLED as input ?
« Reply #5 on: October 07, 2016, 04:58:05 AM »
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.