10 REM *** 12 REM Example Communication Program for F4-CP128-1 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 SDTA=VAL(MID$($(0),1,8)) : REM Parse Data from String 138 S405_VB(2000)=INT(SDTA) : REM Write Data to PLC 140 PRINT1 "Data= ",SDTA 160 REM --- 162 GOTO 130 : REM Loop