f2_rdstr_writeplc.abm (F2-CP128)
10 REM ***
12 REM Example Communication Program for F2-CP128
14 REM
16 REM Read a string from a serial device and write the ASCII codes
18 REM for that string into a contiguous block
20 REM of V-memory in a 240,250,250-1, or 260 CPU starting at V2000
22 REM
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 Serial Device
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 PRINT1 “Received> “,$(0)
140 FOR X=1 TO INPLEN STEP 2
142 SHARED((128+X-1),H)=ASC($(0),X)
144 SHARED((128+X-1),L)=ASC($(0),X+1)
146 NEXT X
150 BMOVE W,VH(2000),K(LEN($(0)))
160 REM —
162 GOTO 130 : REM Loop