5 - 35
5 I/O Refreshing
NX-series Digital I/O Unit User’s Manual (W521)
5-2 I/O Refreshing Methods
5
5-2-10 An Example of Turning ON Outputs at Specific Times After the Sensor Inputs Change
CASE State OF
0: //Wait for input bit 00 to change.
IF( InputTimeStamp <> N1_Input_Bit_00_Time_Stamp )THEN
InputTimeStamp:=N1_Input_Bit_00_Time_Stamp; //Save the input changed time for input bit 00.
IF( OffsetTimeStamp <= (OffsetErrorTaskExeCnt * TaskPeriod) )THEN
//If the specified time is 3 task periods or less, error end.
State:=0; //Transit to waiting for input bit 00 to change.
Error:=TRUE; //Error registration
ErrorCode:=WORD#16#0001;
ELSE
//Set the specified time.
SetOutputTimeStamp:=InputTimeStamp+OffsetTimeStamp;
N2_Output_Bit_00_Time_Stamp:=SetOutputTimeStamp;
N2_Output_Bit_00:=TRUE;
State:=1; //Transit to output check.
END_IF;
END_IF;
1: //Check the output.
IF( E001_Time_Stamp_of_Synchronous_Output < SetOutputTimeStamp )THEN
; //Continue output check because the specified time has not been reached.
ELSE
//Check the output status because the specified time has passed.
IF( N2_Output_Bit_00_Output_Status=FALSE )THEN
//Output completion
N2_Output_Bit_00_Time_Stamp:=0;
N2_Output_Bit_00:=FALSE; //Turn OFF the output.
State:=0; //Transit to waiting for input bit 00 to change.
ELSE
//Output error
Error:=TRUE; //Error registration
ErrorCode:=WORD#16#0002;
State:=0; //Transit to waiting for input bit 00 to change.
END_IF;
END_IF;
ELSE
;
END_CASE;