Brookfield DV-II+ Digital Viscometer User Manual
Page 42

- 42 -
Shear Stress (Dynes/Cm2)
= TK * SMC * SRC * Torque
= 0.09373 * 32.0 * 0.34 * 62.3
= 63.5 Dynes/Cm2
The following is a program written in BASIC that receives these strings, parses out the appropriate
data, performs the above calculations and displays the data to the screen.
100
‘+
+
110
‘| DV-II+ Communications Demonstration |
120
‘| Copyright 1992, Brookfield Engineering Laboratories |
130
‘| Written by Richard Trudell & Greg Krysko |
140
‘+
+
150
CLS
160
PRINT SPC(26); “Brookfield Engineering Labs”
170
PRINT SPC(19); “DV-II+ Communications Demonstration Program”
180
PRINT SPC(32); “Copyright 1992”
190
200
PRINT “This program is intended to demonstrate the method for obtaining”
210
PRINT “data from the Brookfield Engineering Labs DV-II+ using an RS-232”
220
PRINT “port.”
230
PRINT “This program and/or any of the methods used within may be freely”
240
PRINT “used in your own applications.”
250
260
PRINT “Press any key to continue...”
270
KEYPRESSED$ = “”
280
WHILE KEYPRESSED$ = “”
‘
Wait for keypress
290
KEYPRESSED$ = INKEY$
300
WEND
310
CLS
‘ Clear display screen
320
OPEN “COM1:9600,N,8,1,CS,DS,CD” FOR RANDOM AS #1
‘ Open com port #1
330
LF$ = CHR$(10)
‘ Initialize variables
340
ESC$ = CHR$(27)
350
KEYPRESSED$ = “”
360
WHILE KEYPRESSED$ <> ESC$
370
GOSUB 790
380
LF = INSTR(DS$, LF$)
390
IF LF THEN DS$ = LEFT$(DS$, LF - 2)
400
LOCATE 1, 1
410
PRINT “Here is DV-II+ Viscometer raw output data string”;
420
LOCATE 2, 1
430
PRINT DS$;
440
‘+
+
450
‘| Parse Viscometer data string into constituent parts |
460
‘+
+
470
TOR$ = MID$(DS$, 29, 4) ‘ Torque is char’s 29 - 32
480
CPS$ = MID$(DS$, 39, 9) ‘ Centipoise Value is char’s 39 - 47
490
SHS$ = MID$(DS$, 55, 5) ‘ SS Value is char’s 55 - 59
500
SHR$ = MID$(DS$, 67, 5) ‘ SR Value is char’s 67 - 70
510
RPM$ = MID$(DS$, 6, 3) ‘ Spindle speed is char’s 6 - 8
520
MDL$ = MID$(DS$, 13, 5) ‘ Viscometer model is char’s 13 - 17
530
SPD$ = MID$(DS$, 24, 2) ‘ Viscometer spindle is char’s 24 - 26
540
TMP$ = MID$(DS$, 75, 5) ‘ Temperature starts at char 75