Brookfield CAP2000 Viscometer User Manual
Page 32
Brookfield Engineering Labs., Inc.
Page 32
Manual No. M/94-310F
SAMPLE PROGRAM FOR EXTERNAL COMPUTER CONTROL OF CAP 2000
VISCOMETER
This program can be used with GWBasic, Basic, Basica, or QuickBasic. The complete program or
any portion thereof may be freely used but not resold. Please note that little or no error checking is
performed in this program. It is supplied to provide a working example of the CAP 2000 interface
commands.
1000 ‘
1005 ‘ CAP 2000 External Mode Command Protocol Demonstration
1010 ‘ Copyright 1994, Brookfield Engineering Labs
1015 ‘ Written by Greg Krysko
1020 ‘
1025 ‘
1030 CLS
1035 PRINT SPC(26); “Brookfield Engineering Labs”
1040 PRINT SPC(20); “CAP 2000 External Mode Demonstration Program”
1045 PRINT SPC(32); “Copyright 1994”
1050 PRINT
1055 PRINT “This program is intended to demonstrate the use of the RS-232 com-
mand “
1060 PRINT “set employed by the Brookfield Engineering Labs CAP 2000 Viscometer
“
1065 PRINT “in its External mode. This program and/or any of the commands used
“
1070 PRINT “within may be freely used in your own applications.”
1075 PRINT
1080 PRINT “Press any key to continue...”
1085 GOSUB 1490 ‘ Wait for a keypress
1090 CLS
1095 GOSUB 1655 ‘ Initialize variables
1100 OPEN “COM1:9600,N,8,1,CS,DS,CD” FOR RANDOM AS #1' Open com port #1
1160 INPUT “Enter a cone number: “; CONE
1161 INPUT “Enter sample temperature (øC):”; SETTEMP
1162 CAPVALUE = CONE
1165 CMDLEN = 2
1170 GOSUB 1595 ‘ Convert cone to hex
1175 CAPCOMMAND$ = “S” + HEXVALUE$
1176 GOSUB 1815 ‘ Send command to CAP 2000
1177 GOSUB 1870 ‘ Wait for CAP 2000 response
1180 PRINT
1181 PRINT “The CAP 2000 will bring the sample temperature to”; SETTEMP; “deg
C.”
1185 PRINT “The viscometer will then ramp to 100 RPM and will increment”
1190 PRINT “its speed by 100 RPM every 30 seconds. At the end of each”
1195 PRINT “30 second interval, a data point will be taken and displayed”
1200 PRINT “on the screen. This will continue until a data point is taken”
1205 PRINT “at 1000 RPM at which point the CAP 2000 will return to 0 RPM.”
1210 PRINT
1215 PRINT “Press any key to continue...”
1220 GOSUB 1490 ‘ Wait for a keypress
1221 CAPVALUE = SETTEMP * 10
‘ Set value to be made hex
1222 CMDLEN = 3 ‘ Set pad length
1223 GOSUB 1595 ‘ Convert Temp value to hex
1224 CAPCOMMAND$ = “T” + HEXVALUE$ ‘ Temperature command 1225 GOSUB