Example – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 197

Advertising
background image

Publication 1746-RM001A-US-P

Input Functions 13-7

Example

>1

REM EXAMPLE PROGRAM

>10

REM ENABLE CALL 22 INTERRUPTS

>20

PUSH 1 : REM PRT1 ACTIVE FOR CALL 22

>30

PUSH 10 : REM RECEIVING 10 BYTES OF DATA MAXIMUM

>40

PUSH 13 : REM <CR> USED AS TERMINATION CHARACTER

(13 DECIMAL)

>50

PUSH 1 : REM SEND DATA TO M1 FILE

>60

PUSH 0 : REM OFFSET INTO M1 FILE

>70

PUSH 0 : REM STRING NUMBER - NOT USED

>80

PUSH 1 : REM BYTE SWAPPING ENABLED

>90

CALL 22

>100 POP S : REM STATUS OF CALL 22 SETUP

>110 IF (S<>0) THEN PRINT “UNSUCCESSFUL CALL 22 SETUP”

>120 END

Below is a sample ladder logic program for CALL 22. The module is located in slot
1 of the SLC chassis. At rung 0000, copy data from the M1 file when the
handshake bit (I:1.0/8) is set by the module. The SLC sets handshake bit (O:1.0/8)
once the data has been copied out of the M1 file. This informs the module to turn
off (I:1.0/8). The first word of the M1 file contains the byte count and this word is
not included in the data byte count. A maximum of 10 bytes of data is expected in
this example.

0000

I:1

8

COP

Copy File
Source

#M1:1.0

Dest

#N7:0

Length

6

L

O:1

8

0001

END

Handshake Bit from
Module to SLC Processor

Handshake Bit from
SLC Processor to Module

Advertising