REVISITED FLEXPORT FP-4U DATA ACQUISITION PROGRAM

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

cbey
Newbie
Posts: 5
Joined: Wed Oct 29, 2008 12:22 pm

REVISITED FLEXPORT FP-4U DATA ACQUISITION PROGRAM

Postby cbey » Thu Jul 02, 2009 5:16 pm

I have revisited the original flexport gage interface data acquisition pogram I posted previously to include a real time plot display as well as the immediate creation of an excel file for plotting and data analaysis.

I wish to extend a special thanks to folks at MidwestFlex for the loaner flexport FP-4U to test the program on.

Typically the flexport can be used in conjunction with the Chicago Dial Indicator gage to measure the linear length and subsequent change in linear length of mortars and grout formulations.

Currently for many this is accomplished by taking periodic, manual readings. This manual method has many limitations, but primarily the lack datapoints overnight and during weekends. This program is provided as a facilitator for the utilization of the Flexport FP gage interfaces which when used in conjunction with the Chicago Dial Inidcator gages can allow automated data acquisition via a personal computer, hence "filling in the gaps" where reading were not previously taken.

The program currently provided was written in QBASIC due to it's ease in comprehension and modification, availability and negligible cost. That is not to say there aren't limitations to using QBASIC (i.e. imperfect timing). The aformention limitations are undoubtedly magnified due to my programming ability (or lack thereof), for which I apologize.

I do plan to post future versions in Visual C++.

It is my hope that this program will serve as guidance for those looking to utilize the gages and interfaces mentioned earlier, and perhaps to inspire others to adapt it for other purposes or to improve upon it.

CBey

Code: Select all

    CLS
    CLEAR

    'BASIC DATA AQCUISITION PROGRAM...
    'INTENDED FOR THE FLEXPORT FP 4U IN DEFAULT CONFIGURATION
    'IN CONJUNCTION WITH CHICAGO DIAL INDICATOR BG COMPARATOR GAGES
    'PLEASE BE SURE TO DISABLE THE AUTO-OFF FUNCTION (INDICATED BY HOURGLASS) ON THE GAGE...
    'BY PRESSING AND HOLDING "2ND" BUTTON UNTIL "2ND" APPEARS ON SCREEN, THEN PRESS "OFF" BUTTON...
    'TO DISABLE AUTO OFF FUNCTION.  THE HOURGLASS SHOULD DISAPPEAR
    'ALSO BE CERTAIN TO DISABLE SCREENSAVER AND POWERSAVE FEATURES ON YOUR COMPUTER AS THEY WILL INTERRUPT READINGS
    'THIS PROGRAM WAS WRITTEN IN QBASIC SO THE CODE WOULD BE EASY TO FOLLOW AND MODIFY AS WELL AS HAVING A READILY   
    '...AVAILABLE FREE COMPILER ONLINE

    SCREEN 12'SOME MONITORS MAY NOT SUPPORT THIS SCREEN CONFIGURATION
    INPUT "PLEASE ENTER A FILENAME TO RECORD YOUR MEASUREMENTS"; FILE$
    INPUT "SAMPLING RATE IN SECONDS (I.E. ENTER 30 FOR EVERY 30 SECONDS)"; RATE
    INPUT "TOTAL SAMPLING DURATION IN MINUTES"; SAMPLE
    LET DURATION = SAMPLE * 60
    LET READINGS = DURATION / RATE
    ACTREAD = READINGS + 1
    FILENAME$ = FILE$ + ".XLS"
    OPEN "COM1:9600,N,8,1,CD,CS,DS,RS" FOR RANDOM AS #1
    OPEN FILENAME$ FOR OUTPUT AS #2' CREATES EXCEL FILE FOR DATA
    PRINT #2, "TIME(SEC)"; CHR$(9); "LLC1"; CHR$(9); "LLC2"; CHR$(9); "LLC3"; CHR$(9); "LLC4"; CHR$(9); "DATE";CHR$(9); "TIME"; CHR$(9); "CPU TIMER"'COLUMN HEADERS IN EXCEL SPREADSHEET..CONTINUATION OF PREVIOUS LINE
   
    CLS
    PRINT "PRESS 'Esc' TO STOP MEASUREMENTS..."'INTRO FOR INKEY BELOW ALLOWING ONE KEY TERMINATION OF MEASUREMENTS
    VIEW PRINT 14 TO 15: LOCATE 15, 4: PRINT "0"
    VIEW PRINT 3 TO 4: LOCATE 3, 3: PRINT "+5"
    VIEW PRINT 26 TO 27: LOCATE 26, 3: PRINT "-5"
    VIEW (500, 400)-(40, 40), , 1'ESTABLISHES VIEW WINDOW FOR GRAPH
    WINDOW (0, -5)-(ACTREAD, 5)'ESTABLISHES SCALE FOR GRAPH
    LINE (0, 0)-(ACTREAD, 0)'SETS 0 LINE FOR MONTORING EXPANSION OR SHRINKAGE
    FOR X = 0 TO READINGS
    Z = X * RATE
    VIEW PRINT 29 TO 30
    LOCATE 30, 15: PRINT DATE$, TIME$

    'LLC1
    WRITE #1, "!@R01"'COMMAND TO FLEXPORT CHANNEL 1 TO TAKE COMPARATOR READING
    INPUT #1, A$, COUNT, LREADING1, MODE$, B$'ASSIGNMENT OF VARIABLES AND ACQUISITION OF READING
    PSET (X, LREADING1)'GRAPHING DATA POINTS FOR LLC1
    LINE STEP(0, 0)-STEP(.35, 0), 2
    'LLC2 READING
    WRITE #1, "!@R02"
    INPUT #1, A$, COUNT, LREADING2, MODE$, B$
    PSET (X, LREADING2)'GRAPHING DATA POINTS FOR LLC2
    CIRCLE STEP(0, 0), .25, 3
    'LLC3 READING
    WRITE #1, "!@R03"
    INPUT #1, A$, COUNT, LREADING3, MODE$, B$
    PSET (X, LREADING3)'GRAPHING DATA POINTS FOR LLC3
    LINE STEP(0, 0)-STEP(0, .25), 4
    'LLC4 READING
    WRITE #1, "!@R04"
    INPUT #1, A$, COUNT, LREADING4, MODE$, B$
    PSET (X, LREADING4)'GRAPHING DATA POINTS FOR LLC4
    CIRCLE STEP(0, 0), .125

    PRINT #2, Z; CHR$(9); LREADING1; CHR$(9); LREADING2; CHR$(9); LREADING3; CHR$(9); LREADING4; CHR$(9); DATE$;CHR$(9); TIME$; CHR$(9); TIMER',READING,MODE$ TO BE INCLUDED SENDS DATA TO COLUMNS IN EXCEL SPREADSHEET
    VIEW PRINT 10 TO 15
    COLOR 2
    LOCATE 10, 65: PRINT "LLC1 "; USING "###.###"; LREADING1 'REALTIME DATA VIEW IN TXT
    COLOR 3
    LOCATE 11, 65: PRINT "LLC2 "; USING "###.###"; LREADING2
    COLOR 4
    LOCATE 12, 65: PRINT "LLC3 "; USING "###.###"; LREADING3
    COLOR 7
    LOCATE 13, 65: PRINT "LLC4 "; USING "###.###"; LREADING4
    VIEW PRINT 29 TO 30
   
    LOCATE 29, 45: PRINT "X="; Z
   
    VIEW PRINT 16 TO 20
    LOCATE 16, 65: PRINT FILENAME$
    LOCATE 17, 65: PRINT "RATE"; RATE
    LOCATE 18, 65: PRINT "DURATION"; SAMPLE
    LOCATE 19, 65: PRINT "READINGS"; ACTREAD

    IF X = READINGS THEN END ELSE
    TIME = 804269 '(792055/SECOND) to (806807/SECOND) APPROXIMATELY WILL DEPEND ON CPU CLOCK SPEED AND TIME TO       
  '... EXECUTE INTERSTITIAL COMMANDS
    IF INKEY$ = CHR$(27) THEN END ELSE
    FOR J = 1 TO RATE
    IF INKEY$ = CHR$(27) THEN END ELSE 'OPTIONAL INTENDED FOR LONG DURATION BETWEEN SAMPLES (OR USE CTRL + BREAK)
    FOR t = 0 TO TIME
    NEXT t
    NEXT J
    NEXT X

Return to “QBASIC and QB64 Questions & Answers”

Who is online

Users browsing this forum: No registered users and 6 guests