f0_rdstr_writeplc.abm (F0-CP128)

10           REM ***

12           REM Example Communication Program for F0-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 05 or 06 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 3,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         INPUT3 ,$(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         DPORT((X-1),H)=ASC($(0),X)

144         DPORT((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

×