Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: sshneider on November 26, 2019, 03:04:49 PM
-
Can anyone explain how to create a simple toggle button (code/script) that I can use to turn on/off an output or trigger a Modbus command? Thanks much for any replies/guidance/links/videos/etc.
-
If IsActive(OUTPUT1) Then
DeactivateSignal (OUTPUT1)
Else
ActivateSignal (OUTPUT1)
End If
-
HEY!! Just saw this (don't know why the notification via email isn't working??) but THANK YOU VERY MUCH SIR!
-
OK, I just tried it.... Output is activated as expected but will not Deactivate. I'm using Output 6 and copied your script only changing the "1" to a "6". Any ideas what could be Wonky?? THANK YOU!!!
-
for Output 6 try this:
If GetOEMLed(79) Then
DeactivateSignal (OUTPUT6)
Else
ActivateSignal (OUTPUT6)
End If
-
Worked like a Charm!! THANK YOU !!!!!
-
NEXT QUESTION!!! What you explained works GREAT for Outputs already a part of the MACH3 architecture BUT, what if you run out of MACH3 Outputs and just want to turn on/off more devices via MODBUS/PLC.
For example, I want to turn on/off the Air Compressor in my shop by pushing a button on MACH3 Screen.
Simply Put... in the example below... what do I enter to replace the OUTPUT1 identifier so it will be recognized by MODBUS instructions?
DeactivateSignal (OUTPUT1)
Else
ActivateSignal (OUTPUT1)
what do I enter to replace the OUTPUT1 identifier so it will be recognized by MODBUS instructions?
THANKS AGAIN SO VERY MUCH FOR YOUR HELP!
-
should be
SetOutBit(BuffIndex, BitNumber)
ReSetOutBit(BuffIndex, BitNumber)
but never worked with modbus
-
Thanks for your reply. Sorry if this is a stupid question but.... How do I know the BUFFINDEX address? are you referring to the MODBUS Address? Not clear on this. Perhaps and example with some sample data would be helpful if you wouldn't mind??
THANK YOU!
-
as written i never worked with modbus,
but here
http://www.machsupport.com/videos/
is a Video witch explains modbus a Little bit.