Author Topic: custom function (trilogy 6)  (Read 12700 times)

jackson5

  • Newbie
  • *
  • Posts: 2
  • I'm a llama!
    • View Profile
custom function (trilogy 6)
« 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

Philippe Parmentier

  • Newbie
  • Posts: 29
  • new in plc
    • View Profile
Re:custom function (trilogy 6)
« Reply #1 on: April 15, 2014, 12:25:57 PM »
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
« Last Edit: April 15, 2014, 12:28:38 PM by Philippe Parmentier »

jackson5

  • Newbie
  • *
  • Posts: 2
  • I'm a llama!
    • View Profile
Re:custom function (trilogy 6)
« Reply #2 on: April 15, 2014, 12:59:00 PM »
Thank you, that was very helpful :)