Rockwell Automation 1203 Serial Communications Module Series A User Manual
Page 46

Chapter 5
Configuration and Interfacing
5-10
DF1 Messaging with a 1746-BAS Module Example
(Write 10 Parameters then read 10 parameters)
10
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
20
REM
30
REM This file is a program for the 1746–BAS module.
40
REM
50
REM It performs a PLC2 Unprotected Write (08) followed by
60
REM a PLC2 Unprotected Read (01) over the DF1 link on port #2
70
REM
80
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
90
STOP
100
STRING 0,0
110
STRING 512,127
120
$(1)=”THIS IS A TEST! ”
130
REM
140
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
150
REM Setup port 1 to 9600 baud, no parity, 8 bits, 1 stop bit,
160
REM software handshaking, and battery backed ram data storage.
170
REM !!!!REMEMBER TO SET TERMINAL TO MATCH!!!!
180
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
190
MODE (PRT1,9600,N,8,1,S,R)
200
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
210
REM
220
REM Setup port 2 to 300 baud, no parity, 8 bits, 1 stop bit,
230
REM software handshaking, and battery backed ram data storage.
240
REM
250
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
260
MODE (PRT2,300,N,8,1,S,R)
270
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
280
REM
290
REM Enable DF1 driver
300
REM (20 = Setup for Full Duplex, Auto–Detect Embedded Responses,
310
REM Disable Duplicate Packet Detection, BCC error checking)
320
REM (200 = Wait 1 second for polling by Master)
330
REM (2 = 2 retries)
340
REM (0= No RTS on delay)
350
REM (0 = No RTS off delay)
360
REM (8 = 1746–BAS module address)
370
REM ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
380
PUSH 20
390
PUSH 200
400
PUSH 2
410
PUSH 0
420
PUSH 0
430
PUSH 8
440
CALL 108
450
REM DF1 PLC REMOTE WRITE COMMAND
460
PUSH 2 : REM PLC2 Unprotected Write
470
PUSH 1 : REM Communications Module Node Address
480
PUSH 11 : REM File Number (ignored in this example)
490
PUSH ASC(N) : REM Communications Module File Type
500
PUSH 623 : REM Starting Word in File
510
PUSH 10 : REM Number of Words to Transfer
520
PUSH 50 : REM Command Time–out (x100ms)