Internet PLC Forum
General => Technical support => Topic started by: jackson5 on April 15, 2014, 09:51:47 AM
-
I don't understand how to get the custom function to influence relays and inputs.
I want to set up a custom function that would turn on a switch if certain conditions were met, but I can't work out how.
Thanks
-
Hello,
In the customs functions you have some TBASIC functions
SETIO relay/output-name ' To set On the corresponding relay
CLRIO relay.output-name ' To set Off the corresponding relay
TOGGLEIO relay/output-name 'To invert the current state of the corresponding relay (From ON to OFF or OFF to On)
TESTIO (relay/output-name) 'To verify in an IF Statement. function return 1 if the corresponding relay is ON and 0 if Off.
exemple:
IF TESTIO (RELAY1) = 0 THEN SETIO RELAY1 ENDIF 'Change the state of RELAY1 from 0 to 1
IF TESTIO (RELAY1) = 0 THEN TOGGLEIO RELAY1 ENDIF 'Change the state of RELAY1 from 0 to 1
In the I)Trilogy softwareinstallation you have a sample file that illustrate theses commands:
C:\TRILOGI\TL6\usr\Samples\setIO.PC6
-
Thank you, that was very helpful :)