MSI-4300 Porta-Weigh Plus/7 Key
•
User Guide
Page 39
M E A S U R E M E N T S Y S T E M S I N T E R N A T I O N A L
PORTA-WEIGH PLUS BASIC PROGRAMMING EXAMPLE
Note: The following BASIC program is intended as an example only.
Measurement Systems International does not guarantee that it will run
without modification on any personal computer. There can be signifi-
cant timing and compatibility differences from PC to PC.
Programming Example:
This basic routine interrogates the scale as to what the currently
selected modes are, prints them, and then prints out the current
weights for GROSS, NET, TARE (A valid Tare Weight must be
stored prior to running this program), Peak GROSS, and VIEW
TOTAL. This routine is written in GW-BASIC and is configured to
operate out of COM Port 1. Baud rate and EIA-232-D configurations
are factory set to 9600 baud, 1 stop bit, 8 data bits, and no parity.
100 CLS:LOCATE 1:DEFINT A,Z:
REM Initialize Screen
110 COMFIL$="COM1:9600,N,8,1,RS,CS0,DS0,CD0":
REM Setup PC Comm Port
120 OPEN COMFIL$ AS #1
130 PRINT #1,"Q":
REM Query PAW+ Selected Modes
140 A$=INPUT$(1,#1):A=ASC(A$):
REM Input Mode Data
150 IF A$ < " " AND A$ > "/" THEN PRINT "ERROR
Wrong Data Returned":GOTO130
160 IF A AND 1 THEN W$="ON " ELSE W$ = "OFF":
REM Auto Total Mode
170 IF A AND 2 THEN X$="ON " ELSE X$ = "OFF":
REM View Total Mode
180 IF A AND 4 THEN Y$="ON " ELSE Y$ = "OFF":
REM Peak Hold Mode
190 IF A AND 8 THEN Z$="ON " ELSE Z$ = "OFF":
REM Net Mode
200
REM Print current selected Mode status
210 PRINT "AUTO TOTAL IS ";W$;" VIEW TOTAL IS ";X$
220 PRINT "PEAK HOLD IS ";Y$;" NET MODE IS ";Z$
230 GOSUB 400:GOSUB 410:
REM Set Gross Mode, Print GROSS Weight
240 PRINT #1,"C":GOSUB 410:
REM Set Net Mode, Print NET Weight
250 PRINT #1,"D":GOSUB 410:
REM Display Tare, Print TARE Weight
260 GOSUB 400:GOSUB 430:
REM Reinitialize to GROSS, Delay
270 PRINT #1,"N":GOSUB 410:
REM Set Peak Hold Mode, Print Peak Wgt
280 GOSUB 400:GOSUB 430:
REM Reinitialize to GROSS, Delay
290 PRINT #1,"F":GOSUB 410:
REM Set View Total, Print TOTAL Weight
300 END:
REM End of Program,start of subroutines
400 PRINT #1,"K":RETURN:
REM Set Gross Mode subroutine
410 GOSUB 430:PRINT #1,"J":
REM Delay, then tell PAW+ to transmit
420 A$=INPUT$(24,#1):PRINT A$:RETURN:
REM Capture data, print to screen
430 FOR I =1 TO 500:NEXT I:RETURN:
REM Delay subroutine
Note: The time of the delay routine was set for a 20MHz CPU. Adjust
up or down as needed for other speeds.