UPDATEOUT

Top  Previous  Next

UPDATEOUT will force an update of all outputs on the RTCU platform. Normally UPDATEOUT is not needed as the BEGIN/END construction will handle the updating of the outputs. But in some cases, it can be necessary to utilise the UPDATEOUT manually in a program. For example in a REPEAT statement, it could be necessary to update all outputs in each iteration.

 

 

Example:

INCLUDE rtcu.inc
 
VAR_OUTPUT
   output : ARRAY[1..16] OF BOOL;| Our 16 digital outputs
END_VAR;
 
VAR
   a      : INT;
END_VAR;
 
PROGRAM test;
 
BEGIN
   a := 1;
 
   REPEAT 
      output[a] := TRUE; // Set the output TRUE
      UPDATEIO; // Update all in- and outputs
      Sleep(delay := 100); // Wait 100 milliseconds
 
      output[a] := FALSE; // Set the output FALSE
      UPDATEOUT; // Update all outputs
      Sleep(delay := 100); // Wait 100 milliseconds
 
      := a + 1; // Next output
   UNTIL > 16
   END_REPEAT;
 
END;
 
END_PROGRAM;

 
This example will make a "running" light on the 16 outputs. Output 1 will be on for 100 ms, then output 2 will be on for 100 ms, and so on.