rdscl_f2.abm (F2-CP128)
10 REM ***
12 REM Example Program for F2-CP128
14 REM (1) Read Setpoint data from PLC V-Mem
16 REM SP High Integer = V1401 (0-9999)
18 REM SP High Fractional = V1400 (0-999)
20 REM SP Low Integer = V1403 (0-9999)
22 REM SP Low Fractional = V1402 (0-999)
24 REM NOTE: Setpoint Data Must be in BCD format
26 REM (2) Read Serial Data from Ohaus Lab Scale Connected to Port 2
28 REM Scale Data Format is:
30 REM 1 2-7 8 9-11 12 13 14
32 REM +/- ##.### sp units ? CR LF
34 REM Scale is configured to send data once per second
36 REM (3) Compare Scale Data with Setpoint Data
38 REM If >High Set V1410=1
40 REM If >Low and <High Set V1410=2
42 REM If <Low Set V1410=3
44 REM (4) Repeat from Step 2
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 BMOVE R,VH(1400),K(8) : REM Read SP Data
114 SPH=SHARED(2,B)+(SHARED(0,B)/100) : REM Setpoint High to SPH
115 PRINT1 USING(##.###),”High Setpoint is “,SPH
116 SPL=SHARED(6,B)+(SHARED(4,B)/100) : REM Setpoint Low to SPL
117 PRINT1 USING(##.###),”Low Setpoint is “,SPL
120 REM —
122 PRINT1 “Waiting for Scale Data”
130 REM —
132 INPUT2 ,$(0) : REM Input Scale Data to String 0 ($(0))
134 IF INPLEN=0 THEN PRINT1 “Scale Timed Out” : GOTO 130
136 SDTA=VAL(MID$($(0),1,7)) : REM Parse Scale Data from String
138 S205_VB(2004)=INT(SDTA)
140 PRINT1 SDTA,MID$($(0),9,3),” is “,
150 IF SDTA<SPL THEN S205_VB(1410)=3 : PRINT1 “Low ” : GOTO 160
152 IF SDTA>SPH THEN S205_VB(1410)=1 : PRINT1 “High ” : GOTO 160
154 S205_VB(1410)=2 : PRINT1 “Within Limits”
160 REM —
162 GOTO 130 : REM Loop