Laserfiche WebLink
11056 PRINT # 2, CHR(254),CHR(71),CHR(1),CHR(2), "Delay > ",TDLY- TICK(0) <br />11060 UNTIL TICK(0) >TDLY <br />REM let user know sensor warmup is done <br />11070 PRINT "Sensor Warmup Complete, Taking Readings now..." <br />11071 PRINT <br />11075 PRINT #2,CHR(12), <br />11076 PRINT #2, "Taking Readings now" <br />11077 PRINT #2, "Standby for results" <br />11078 PRINT #2,1'...." <br />REM begin read loop for averaging multiple readings <br />11100 DO <br />REM increment loop counter <br />11110 X =X +1 <br />REM read analog flow depth signal <br />REM register 2 is the first analog input, <br />REM register 3 is the 2nd ai, etc... <br />REM read All <br />11120 AII= REGREAD(2) <br />REM check for good reading (< 4069) <br />REM if bad reading is received, read again <br />REM if good reading, add to previous sum <br />11125 IF AI1<4096 THEN DPTHSUMI = DPTHSUMI +AI1 ELSE 11120 <br />REM read AI2 <br />REM 11130 AI2= REGREAD(3) <br />REM check for good reading (< 4069) <br />REM if bad reading is received, read again <br />REM if good reading, add to previous sum <br />REM 11135 IF AI2<4096 THEN DPTHSUM2 = DPTHSUM2 +AI2 ELSE 11130 <br />REM continue until x readings have been taken <br />11140 UNTIL X =100 <br />REM calculate average of readings <br />11150 SIGAVGI = DPTHSUMI /X <br />11155 SIGAVG2= DPTHSUM2 /X <br />REM set print to formatted output <br />11160 PRINT USING( # # # #. # #), <br />REM print averaged signal value <br />11170 PRINT "Sensor 1 Avg = ", SIGAVGI <br />11175 PRINT "Sensor 2 Avg = ", SIGAVG2 <br />REM turn off excitation voltage <br />11180 REGWRITE 4823,0 <br />REM calculate (Y) depth <br />REM get slope, offset & min. depth values from <br />REM modbus registers <br />11200 SLPI= REGREAD(7033) : SLP2= REGREAD(7034) <br />11205 OFFI= REGREAD(7037) : OFF2= REGREAD(7038) <br />11210 YMINI= REGREAD(7053) : YMIN2= REGREAD(7054) <br />REM calculate flow depth using slope and offset <br />11220 Y1= (SIGAVGI *SLP1) +OFF1 <br />11225 Y2= (SIGAVG2 *SLP2) +OFF2 <br />11230 PRINT "Sensor 1 Calculated Flow Depth (Y1) = ", Yl," FT" <br />11235 PRINT "Sensor 2 Calculated Flow Depth (Y2) = ", Y2," FT" <br />37 <br />