Dl50 basic alarm programming example, Program continued on next page) – Rockwell Automation 2706-F11J_F11JC_F21J_F21JC DL50 INSTALLATION MANUAL User Manual

Page 76

Advertising
background image

Chapter 6

Slave Mode Operation / Examples

6–12

DL50 BASIC Alarm Programming Example

This example is for Catalog No. 2706-F11J, -F11JC. Use it as a guide in
creating your own alarm programs. The program determines which alarm(s)
are current and the priority in which they are displayed. The program is
compatible with Microsoft QuickBasic and IBM GW BASIC / BASIC A.

Here is a quick summary of the program:

Lines 5 to 10 initialize the computer communications port for the DL50.
Lines 100 and 120 send the alarm message to the DL50.
Lines 1005 to 2000 define the messages.
Lines 4000 to 6000 determine current alarms and priority.
Lines 9000 to 9200 provide a menu of the available test messages.

Program:

5 REM

LINE 10 PREPARES SERIAL PORT ’COM1’ TO SEND MESSAGES TO THE DL50

6 REM

WITH BAUD RATE = 9600

10 OPEN “com1:9600,n,8,1,cs,ds,cd”FOR RANDOM AS #1

20 REM

THE USER INSERTS

30

OTHER ’INITIALIZATION’ CODE HERE

35

THE PROGRAM DOES A ’GOSUB’ TO LINES 4000-6000 TO EVALUATE IF ANY

36

ALARMS ARE CURRENT AND WHICH WOULD GET PRIORITY TO BE DISPLAYED.

40 GOSUB 4000

97 REM

LINE 100 DETERMINES WHICH OTHER ’GOSUB’ LINE WILL DEFINE WHAT NEEDS

98 REM

TO BE SENT TO THE DL50

99 REM ALARM= 1 2 3 4 5 6 7 8

100 ON ALARM

GOSUB 1005, 1010, 1015, 1020, 1025, 1030, 1035, 2000

120 PRINT #1, M$ ; CHR$ (ADDRESS) ; CHR$(LN) ; CHR$(13)

130 GOTO 35

998 REM

LINES 1005-2000 DEFINE THE MESSAGES TO BE SENT TO THE DL50

999 REM

SPACING, LINE CHOICE (AND SOMETIMES CHARACTER HEIGHT), ADDRESSING

1000

AND BLINKING CHARACTERS ARE ALL DETERMINED HERE

1001 REM

1002 REM

M$, THE ADDRESS, AND LINE NUMBER ARE SENT TO THE DL50 AFTER

1003 REM

THE “RETURN”

1004 REM

1005 LN=1: ADDRESS = 1: M$ = “TEST ALARM #1”

1006 RETURN

1010 LN=2: ADDRESS = 1: M$ = “TEST ALARM #2”

1011 RETURN

1015 LN=3: ADDRESS = 1: M$ = “TEST ALARM #3”

1016 RETURN

1020 LN=3O: ADDRESS = 1: M$ = “ THIS IS A TWO-LINE TEST ALARM #4 ”

1021 RETURN

(Program continued on next page)

Advertising