beautypg.com

Measurement Computing WaveBook rev.3.0 User Manual

Page 193

background image

WaveBook User’s Manual,

6-22-99

daqX API - Programming Models C-19

Write the scans read and unpacked to the text file

For i& = 0 To scanCount& - 1
For j& = 0 To channels& - 1

Send a tab between channels and a newline after each scan:

If (j& < channels& - 1) Then
termChar$ = Chr$(9)
Else
termChar$ = Chr$(13) + Chr$(10)
End If

Calculate and write out the voltage value:

voltage! = buf%(i& * channels& + j&) * 5! / 32768!
Print #2, Format$(voltage!, ".000") + termChar$;
Next j&
Next i&

Print something so the program does not appear to be locked:

Print ".";
Loop While (byteCount& > 0) ' A byteCount of 0 indicates end-of-file
' Close the input and output files
Close 1
Close 2
Print "complete."

After program execution: data has been collected directly to disk in a binary file format, the WaveBook
device closed, the binary file was then opened, the data unpacked, and then written to a text file.