f2comex3.abm (F2-CP128)
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 two serial devices (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 Device 1
106 SETPORT 2,9600,N,8,1,N : REM Device 2
108 SETINPUT 1,1,10,0,1000,20 : REM Define how INPUT will work
130 REM —
132 INPUT1 ,$(0) : REM Input Data to String 0 ($(0))
134 IF INPLEN=0 THEN GOTO 150 : REM If Time-Out goto Port 2
136 X=VAL(MID$($(0),1,9)) : REM Parse Data from String
138 XHI=INT(X/10000) : XLO=X-(XHI*10000) : REM Separate High/Low Word
140 S205_VB(2000)=XLO : REM Write Low Byte
142 S205_VB(2001)=XHI : REM Write High Byte
150 REM —
152 INPUT2 ,$(1) : REM Input Data to String 1 ($(1))
154 IF INPLEN=0 THEN GOTO 130 : REM If Time-Out goto Port 1
156 X=VAL(MID$($(1),1,9)) : REM Parse Data from String
158 XHI=INT(X/10000) : XLO=X-(XHI*10000) : REM Separate High/Low Word
160 S205_VB(2002)=XLO : REM Write Low Word
162 S205_VB(2003)=XHI : REM Write High Word
170 REM —
172 GOTO 130 : REM Loop