Brookfield CAP2000 Viscometer User Manual
Page 35
Brookfield Engineering Labs., Inc.
Page 35
Manual No. M/94-310F
1670 TINTERVAL = 30
1675 RETURN
1795 ‘
1800 ‘
1805 ‘ Routine to send commands to the DV-III
1810 ‘
1815 GOSUB 2035
1820 CAPCOMMAND$ = CAPCOMMAND$ + CR$ ‘ Append a carriage return
‘ to command
1825 FOR CMD = 1 TO LEN(CAPCOMMAND$)
1830 PRINT #1, MID$(CAPCOMMAND$, CMD, 1); ‘ Send one character at a
‘ time
1835 GOSUB 1455 ‘ Delay between characters
1840 NEXT CMD
1845 RETURN
1850 ‘
1855 ‘
1860 ‘ Routine to receive a response from the DV-III
1865 ‘
1870 RESP$ = “”
1875 WHILE RIGHT$(RESP$, 1) <> CR$ ‘ Wait for a carriage return
1880 ‘ If data in input buffer,
‘ retrieve it
1885 IF LOC(1) > 0 THEN RESP$ = RESP$ + INPUT$(LOC(1), #1)
1890 WEND
1895 RETURN
1900 ‘
1905 ‘
1910 ‘ Routine to parse response to an R command
1915 ‘
1920 HEXRESP$ = MID$(RESP$, 8, 4) ‘ Extract characters 8-11
1921 GOSUB 1990 ‘ Convert to decimal
1922 TORQUE = DECIMALNUM / 100 ‘ Divide torque by 100
1923 HEXRESP$ = MID$(RESP$, 2, 6) ‘ Extract characters 2-7
1924 GOSUB 1990 ‘ Convert to decimal
1925 VISC = DECIMALNUM / 100 ‘ Divide viscosity by 100
1926 HEXRESP$ = MID$(RESP$, 12, 6) ‘ Extract characters 12-17
1927 GOSUB 1990 ‘ Convert to decimal
1928 SRATE = DECIMALNUM / 100 ‘ Divide shear rate by 100
1929 SSTRESS = VISC * SRATE ‘ Calculate shear stress
1930 HEXRESP$ = MID$(RESP$, 18, 3) ‘ Extract characters 18-20
1931 GOSUB 1990 ‘ Convert to decimal
1932 TEMPERATURE = DECIMALNUM / 10 ‘ Divide temperature by 10
1965 RETURN
1970 ‘
1975 ‘
1980 ‘ Hex to decimal conversion of a hex string
1985 ‘
1990 HEXRESP$ = “&H” + HEXRESP$ ‘ Append hexadecimal
‘ identifier
1995 DECIMALNUM = VAL(HEXRESP$) ‘ Convert hex string to a
‘ decimal value