beautypg.com

Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 101

background image

Operating Functions

Chapter 5

5–64

Example:

u10 REM PERIPHERAL PORT INPUT USING CALL 35

u20 STRING 200,20

u30 DIM D(254)

u40 CALL 35: POP X

u50 IF X tu2 GOTO 40

u55 REM WAIT FOR DEVICE TO SEND START OF TEXT

u60 REM

u70 DO

u80 I=I+1

u90 CALL 35: POP D(I) : REM STORE DATA IN ARRAY

u100 UNTIL D(I)=3 : REM WAIT FOR DEVICE TO SEND END OF TEXT

u120 REM

u130 REM FORMAT AND PRINT DATA TYPES

u140 PRINT “RAW DATA=”

u150 FOR J=1 TO I : PRINT D(J), : NEXT J

u155 REM PRINT RAW DECIMAL DATA

u160 PRINT: PRINT: PRINT

u170 PRINT “ASCII DATA=”

u180 FOR J=1 TO I : PRINT CHR(D(J)), : NEXT J

u185 REM PRINT ASCII DATA

u190 PRINT: PRINT: PRINT

u200 PRINT “$(1)=”

u210 FOR J=1 TO I : ASC($(1),J)=D(J) : NEXT J

u215 REM STORE DATA IN STRING

u220 PRINT $(1)

u230 PRINT: PRINT: PRINT

u240 I=0

u250 REM

u260 GOTO 40

READY
uRUN

RAW DATA=

65 66 67 68 69 70 71 49 50 51 52 53 54 55 56 57 3

ASCII DATA=
ABCDEFG123456789

$(1)=
ABCDEFG123456789

READY
u

5.8.6
Get Numeric Input
Character from Peripheral
Port – CALL 35 (continued)