Measurement Computing TempScan/1100 User Manual
Page 296

C-26 Program Examples in Quick Basic
879696
TempScan / MultiScan, Appendix C
The following program is
BIN_ACQ.BAS
in the
\EXAMPLES\
subdirectory. It will configure 12
thermocouple and 12 volts channels, set up the MultiScan/1200 for acquisition, and then after the
acquisition is complete, collect the buffered channel readings in a Binary format rather than the default
ASCII format. The Binary format is inherently faster than ASCII format, but the data must be deciphered
after it is collected in order to yield the temperature values.
• Lines 1-3: Although not necessary, it is good practice to reset the MultiScan/1200 at the start of your
application by sending the Reset Power-On (
*R
) command. Wait a few seconds.
• Lines 4-8: To be certain that the reset was successful and the device is ready, Serial Poll the device
until the proper status is returned.
• Lines 9-10: The first thing necessary to start scanning is to setup the measuring mode. In this case, the
MultiScan/1200 will be setup for line-cycle integration / high-speed multi-channel mode.
• Lines 11-12: The Configure Channels (
C
) command will be used once to configure a range of
channels from 1 to 12 as Type T thermocouples, and used again to configure a range of channels from
25 to 36 as 10-Volt DC inputs.
• Line 13: Using the Set Counts (
Y
) command, 400 scans will be taken while in the Pre-Trigger state,
100 while in the Post-Trigger state, and 200 while in the Post-Stop state. The Post-Trigger count is
only valid when the Stop (trigger stop event) is set to Count via the Set Trigger Configuration (
T
)
command. This example will in fact use Count, so this parameter is valid.
• Line 14: Using the Set Scan Interval (
I
) command, the Post-Trigger, Pre-Trigger and Post-Stop scan
intervals are set to the same value of 0.0 second, which defaults the MultiScan/1200 acquisition to fast
mode.
• Line 15: Using the Set Trigger Configuration (
T
) command, the Trigger (trigger start event) is
assigned the Trigger On (
@
) command character as sent by the controller, while the Stop (trigger stop
event) is assigned to Count. Both the Auto Re-arm flag and the synchronization flag are disabled, as
described in previous examples. When the MultiScan/1200 encounters the Execute (
X
) command, it
will be armed and will start the collection of the Pre-Trigger data.
• Lines 16-25: After the last Execute (
X
) command has been received, the MultiScan/1200 arms itself
and then waits for the Trigger (trigger start event). The IEEE 488 Serial Poll (
SPOLL
) command is
used to query the acquisition status of the MultiScan/1200. A
SPOLL
value of 2 signifies that the
MultiScan/1200 has detected the Trigger.
• Lines 26-31: Using the User Status (
U
) command
U0
to query the Event Status Register (
ESR
), we now
wait until the Acquisition Complete event is reached.
• Line 32: Before reading the data, the Set Data Format (
F
) command is sent, instructing the
MultiScan/1200 to return the data in Binary format where every value will be 2 bytes in length. This
command can be issued anytime after the initial reset, and stays in effect until the unit is reset again or
another
F
command is issued.
• Lines 33-40: During the acquisition or after the acquisition has been completed, the Acquisition
Buffer can be queried for the data that is available for transfer. The User Status (
U
) command
U6
can
be used to query the Buffer Status String, as described in previous examples. This example uses the
last parameter of the return string as an indicator of how much data is available to transfer to the IEEE
488 controller. The function
MID$
extracts 7 characters from the string
U$
starting at character 9.
• Lines 41-50: After calculating the number of scans, an integer-type buffer is then prepared for the
data. The offset and segment pointers are supplied to the IEEE 488 driver so that the data can be
transferred using DMA (Direct Memory Access). The Read Buffered Data (
R
) command
R2
instructs
the MultiScan/1200 to supply the oldest Trigger Block of data that is currently available.
• Lines 51-52: At the completion of the DMA transfer, the integer data is now in the buffer
BUFFER%
.
To convert the integer data into temperatures and into voltages, simple calculations are performed.