Message procedure – Rockwell Automation 1775-KA PLC-3 Communication Adapter Module User Manual User Manual

Page 98

Advertising
background image

Programming Examples

Chapter 8

8Ć4

Figure 8.4 presents a printed listing of a Data Highway message
procedure. As the listing indicates, the purpose of the procedure is to
monitor the state of a status bit in a remote Data Highway station.

Figure 8.4

Example Data Highway Message Procedure

;

PROCEDURE –– @REM_TURNON

; This procedure will monitor the state of a bit in a remote
; station and, when that bit goes true, turn on a bit
; locally for either 300 seconds or until the remote bit
; goes false.
;

ON_ERROR @LOG_ERROR
A = = 0

;log errors and time of day

CREATE @TIM–START $B0:0
CREATE @TIM_CTL $TCTL:1
CREATE @TIM_PRE $TPRE:1
T_ON_BIT = 0
T_DONE_BIT = 017
CREATE @PROCESS $N3:7
P_ON_BIT = 5
ON = 1
OFF = 0
LOOP 1:
B0:0/1 = $H023$B5:3/2
IF ($B0:0/1 .EQ. OF) GOTO LOOP1
@TIM_PRE = 300
@TIM_START/T_ON_BIT = ON
@PROCESS/P_ON_BIT = ON
LOOP 2:
$B0:0/1 = $H023$B:3/2
IF (($B0:0/1 .EQ. ON) .AND. (@TIM_CTL/T_DONE_BIT .EQ. OFF)) GOTO LOOP2
@PROCESS/P_ON_BIT = OFF
EXIT

;initialize error pointer
;timer start word
;timer control word
;timer preset word
;timer on bit
;timer done bit
;process word
;process on bit

;check remote bit in loop
;fetch and save remote bit

;set timer for 300 sec
;turn timer on
;turn process on
;check timer and remote bit in loop
;fetch and save remote bit

;

PROCEDURE –– @LOG_ERROR

;This procedure will fetch the error block out of the
; Module Status Area and record it along with the time
; of day in status file 5.
;
CREATE @STATUS $S5
CREATE @ERR_BLK $E2.5.1.4.0
CREATE @TOD $S1:3
@STATUS: (A) = @ERR_BLK,6
@STATUS: (A + 6) = @TOD,2
IF ((ERROR .GE. 81) .AND. (ERROR .LE. 92)) GOTO NO_STN :no station – fatal error
IF (A .GE. 72) GOTO TIMEOUT
A = = A + 8
EXIT

;copy error block (6 words)
;copy time of day (hrs, mins)

;after ten errors, tell operator

;
NO_STN:
$S4:3/5 = 1
STOP

;
TIMEOUT:
$54:3/4 = 1
EXIT

;energize 1775–S4B report generation rung
;exit procedure with an error

;energize 1775–S4B report generation rung
;return to @PREM_TURNON

10035-I

Message Procedure

Advertising