Author Topic: Checking fot Inputs  (Read 10121 times)

M Thouin

  • Guest
Checking fot Inputs
« on: February 13, 2004, 09:13:54 AM »
I want to check the status of my inputs (on or off) using a "for to next" command. Can someone send me a sample code?  

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Checking fot Inputs
« Reply #1 on: February 13, 2004, 09:55:42 AM »
To test the ON/OFF status of an I/O bit, use the TESTIO( label) function or TESTBIT(n, x) function.

IF TESTIO (IN1) THEN

ELSE

ENDIF

You should not use a FOR NEXT loop to check the status of an input because the physical inputs are only updated at the end of the ladder logic scan or execution of the REFRESH statement.  

Email: support@triplc.com
Tel: 1-877-TRI-PLCS