-
1
- #1
I authored this simple code to fill the void for running data acquisition for linear length measurements using the
flexport. Note you'll need to have the flexport connected to either COM1 or COM2 (or you'll have to change your COM
designations to either 1 or 2) for the qbasic compiler to communicate with the Flexport. I'm sure the code could be
improved upon (i.e. the inclusion of graphics, etc.), but my goal was to send data to a text file to export into a
speadsheet program for graphing and analysis. I sincerely hope this helps someone else out there.
CLS
PRINT "FLEXPORT DATA ACQUISITION PROGRAM FOR USE WITH CHICAGO DIAL GUAGE INDICATOR"
INPUT "FILENAME (NAME.TXT)"; FILENAME$
INPUT "NUMBER OF SAMPLES"; SAMPLE
INPUT "SAMPLE RATE (SECONDS)"; RATE
OPEN "COM1:9600,n,8,1,CS,DS,RS" FOR RANDOM AS #1
OPEN FILENAME$ FOR OUTPUT AS #2
FOR Y = 1 TO SAMPLE
FOR X = 1 TO 3
WRITE #1, "!@R01" '
WRITE #1, "R01<CR>" 'COMMANDS TO THE FLEXPORT TO TAKE READING
WRITE #1, "R<CR>" '
NEXT X
INPUT #1, COUNT, READING, MODE$, ID, CR, LF
PRINT Y,DATE$, TIME$, READING, MODE$
PRINT #2, Y,DATE$, TIME$, READING, MODE$
CLOSE #1
LET SRATE=RATE*3600 'RATE IN SECONDS [WILL BE A FUNCTION OF CPU CLOCK SPEED TO CONVERT APPROPRIATE LENGTH TO
SECONDS OR MINUTES OR HOURS...]
' - CHANGE SAMPLE RATE INPUT TEXT ACCORDINGLY
FOR DELAY = 1 TO SRATE
NEXT DELAY
NEXT Y
END
flexport. Note you'll need to have the flexport connected to either COM1 or COM2 (or you'll have to change your COM
designations to either 1 or 2) for the qbasic compiler to communicate with the Flexport. I'm sure the code could be
improved upon (i.e. the inclusion of graphics, etc.), but my goal was to send data to a text file to export into a
speadsheet program for graphing and analysis. I sincerely hope this helps someone else out there.
CLS
PRINT "FLEXPORT DATA ACQUISITION PROGRAM FOR USE WITH CHICAGO DIAL GUAGE INDICATOR"
INPUT "FILENAME (NAME.TXT)"; FILENAME$
INPUT "NUMBER OF SAMPLES"; SAMPLE
INPUT "SAMPLE RATE (SECONDS)"; RATE
OPEN "COM1:9600,n,8,1,CS,DS,RS" FOR RANDOM AS #1
OPEN FILENAME$ FOR OUTPUT AS #2
FOR Y = 1 TO SAMPLE
FOR X = 1 TO 3
WRITE #1, "!@R01" '
WRITE #1, "R01<CR>" 'COMMANDS TO THE FLEXPORT TO TAKE READING
WRITE #1, "R<CR>" '
NEXT X
INPUT #1, COUNT, READING, MODE$, ID, CR, LF
PRINT Y,DATE$, TIME$, READING, MODE$
PRINT #2, Y,DATE$, TIME$, READING, MODE$
CLOSE #1
LET SRATE=RATE*3600 'RATE IN SECONDS [WILL BE A FUNCTION OF CPU CLOCK SPEED TO CONVERT APPROPRIATE LENGTH TO
SECONDS OR MINUTES OR HOURS...]
' - CHANGE SAMPLE RATE INPUT TEXT ACCORDINGLY
FOR DELAY = 1 TO SRATE
NEXT DELAY
NEXT Y
END