f2comex6.abm (F2-CP128)
5 REM ***
10 REM Example Communication Program for F2-CP128
15 REM
20 REM This is a generic example showing how to read data
25 REM from a serial device (scale, bar code, etc), parse numeric
30 REM data from the string and write the numeric data to the PLC
35 REM
40 REM This example assumes that the data is in the following format:
45 REM ##########CRLF
50 REM ***
55 STRING 2551,254 : REM Allocate String Space 10*254 Strings
60 SETPORT 1,9600,N,8,1,N : REM Programming/Monitoring
65 SETPORT 2,9600,N,8,1,N : REM Scale
70 SETINPUT 1,1,10,0,1000,20 : REM Define how INPUT will work
75 REM —
80 PRINT1 “Waiting for Data”
85 REM —
90 REM INPUT2 ,$(0) : REM Input Data to String 0 ($(0))
95 $(0)=”1234567890″
100 REM IF INPLEN=0 THEN PRINT1 “Device Timed Out” : GOTO 130
105 XHI=VAL(MID$($(0),1,2)) : REM Get High Word
106 XMD=VAL(MID$($(0),3,4)) : REM Get Mid Word
107 XLO=VAL(MID$($(0),7,4)) : REM Get Low Word
110 S205_VB(2002)=XHI
111 S205_VB(2001)=XMD
112 S205_VB(2000)=XLO
145 REM —
150 REM GOTO 130 : REM Loop