10 REM *** 12 REM Example Communication Program for F2-CP128 14 REM 16 REM This is a generic example showing how to read data 18 REM from a serial device (scale, bar code, etc), parse numeric 20 REM data from the string and write the numeric data to the PLC 22 REM 24 REM This example assumes that the data is in the following format: 26 REM +########CRLF 100 REM *** 102 STRING 2551,254 : REM Allocate String Space 10*254 Strings 104 SETPORT 1,9600,N,8,1,N : REM Programming/Monitoring 106 SETPORT 2,9600,N,8,1,N : REM Scale 108 SETINPUT 1,1,10,0,1000,20 : REM Define how INPUT will work 110 REM --- 112 PRINT1 "Waiting for Data" 130 REM --- 132 INPUT2 ,$(0) : REM Input Data to String 0 ($(0)) 134 IF INPLEN=0 THEN PRINT1 "Device Timed Out" : GOTO 130 136 X=VAL(MID$($(0),1,9)) : REM Parse Data from String 138 XHI=INT(X/10000) : XLO=X-(XHI*10000) : REM Seperate High/Low Word 140 S205_VB(2000)=XLO : REM Write Low Word 142 S205_VB(2001)=XHI : REM Write High Word 144 PRINT1 "Data= ",X 160 REM --- 162 GOTO 130 : REM Loop