//this script will log the changes of a certain I/O port (1)
 
 
Timestep OFF
LOGFILE = "C:\logbook.log"
WRITELOG "[$xTIME] program start"
WRITELOG "[$xTIME] initial condition of I/O channel 1 is $io01"
 
LABEL CHECKLOOP
     IF IO01 = 1 Then
          //channel is 1, wait for it to become 0
          LABEL WAIT_FOR_0
          IF IO01 = 1 Then GOTO WAIT_FOR_0
          WRITELOG "[$xTIME] state of io channel 1 changed to $io01"
     ELSE
          //channel is 0, wait for it to become 1
          LABEL WAIT_FOR_1
          IF IO01 = 0 Then GOTO WAIT_FOR_1
          WRITELOG "[$xTIME] state of io channel 1 changed to $io01"
     END IF
GOTO CHECKLOOP

BACK TO SAMPLE OVERVIEW