* CLRIO labelname {* Applicable only to M+ PLC models}
* SETIO labelname
* TOGGLEIO
labelname
* TESTIO (labelname)

 Purpose Manipulate the logic states of any input, output, relay, timer or counter contact bit within a CusFn. The labelname refers to the label names defined in the input, output, relay, timer or counter tables.

SETIO set a bit to ON, CLRIO clear the bit to OFF, and TOGGLEIO flip the current logic state of that I/O bit. TESTIO function returns a 1 if the bit is ON and a 0 if the bit is OFF.

Examples SETBIT alarm
IF TESTBIT(alarm) THEN … ELSE …ENDIF
Comments: This function offers a more efficient way of manipulating the I/O bits compared to the SETBIT and CLRBIT function. However, SETBIT and CLRBIT functions has the advantage that they can use variables to indicate the index and bit position of the bit to be affected, whereas the I/O bit that are being affected by the commands here are fixed during compile time.

Note that output bit changed in custom function will only be updated at the physical output at the end of the ladder logic scan unless a "REFRESH" command is being executed.

See Also SETBIT, CLRBIT, TESTBIT

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual