Procedure -- @rem_turnon, Procedure -- @log_error – Rockwell Automation 1775-S5_SR5,D17756.5.5 User Manual PLC-3 FAMILY I/0 User Manual
Page 111
Programming DH and DH+
Message Procedures
Chapter 6
6-20
Figure 6.7
Example Message Procedure that Monitors the State of a Bit in a Remote
Station and Records Any Error Condition
Procedure -- @REM_TURNON
;This procedure monitors the state of a bit in a remote station.
;When that bit goes true, the scanner turns on a bit locally for
;either 300 seconds or until the remote bit goes false.
ON_ERROR @LOG_ERROR
;log errors and time of day
A == 0
;initialize error pointer (interprocedural user symbol)
CREATE @TIM_START $B0:0
;timer start word (local system symbol)
CREATE @TIM_CTL $TCTL:1
;timer control word
CREATE @TIM_PRE $TPRE:1
;timer preset word
T_ON_BIT = 0
;timer on bit (procedural user symbol)
T_DONE_BIT = 017
;timer done bit
CREATE @PROCESS $N3:7
;process word
P_ON_BIT = 5
;process on bit
ON = 1
OFF = 0
LOOP1:
;check remote bit in loop
$B0:0/1 = #H023$B5:3/2
;fetch and save remote bit
IF ($B0:0/1 .EQ. OFF) GOTO LOOP1
@TIM_PRE = 300
;set timer for 300 sec
@TIM_START/T_ON_BIT = ON
;turn timer rung condition on
@PROCESS/P_ON_BIT = ON
;turn process on
LOOP2:
;check timer and remote bit in loop
$B0:0/1 = #H023$B5:3/2
;fetch and save remote bit
IF (($B0:0/1 .EQ. ON) .AND. (@TIM_CTL/T_DONE_BIT .EQ. OFF)) GOTO LOOP2
@PROCESS/P_ON_BIT = OFF
;turn process off
EXIT
Procedure -- @LOG_ERROR
;This procedure reads the error block out of the module status area and
;records it along with the time of day in status file 9.
CREATE @STATUS $S9
CREATE @ERR_BLK $E2.3.TH.3.5.4.0
CREATE @TOD $S1:3
@STATUS:(A) = @ERR_BLK,26
;copy error block (26 words)
@STATUS:(A) = @TOD,2
;copy time of day (hrs, mins)
IF ((ERROR .GE. 81) .AND. (ERROR .LE. 92)) GOTO NO_STN
;no station-fatal error
IF (A .GE. 252) GOTO TIMEOUT
;after ten errors, tell operator
A == A + 28
;update error pointer
EXIT
NO_STN:
$S4:3/5 = 1
;energize 1775-GA report generation message rung
STOP
;exit procedure with an error
TIMEOUT:
$S4:3/4 = 1
;energize 1775-GA report generation message rung
A==0
;clear error pointer
EXIT
;return to @REM_TURNON