Measurement Computing TempScan/1100 User Manual
Page 294

C-24 Program Examples in Quick Basic
879696
TempScan / MultiScan, Appendix C
The following program is
BIN_ACQ.BAS
in the
\EXAMPLES\
subdirectory. It will configure 32
thermocouple channels, set up the TempScan/1100 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 TempScan/1100 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 Configure Channels (
C
) command will be used once to configure a range of channels
from 1 to 16 as Type T thermocouples, and used again to configure a range of channels from 33 to 48
as Type K thermocouples.
• Line 11: The Set Counts (
Y
) command is used to configure the number of scans to take while in the
different acquisition states. In this example, 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 12: The Set Scan Interval (
I
) command sets the time period between scans in hours-minutes-
seconds format. The TempScan/1100 can have two different scan intervals, one for the Post-Trigger
state (acquisition scan interval), and one for the Pre-Trigger and Post-Stop states (normal scan
interval). This example sets up the Post-Trigger, Pre-Trigger and Post-Stop scan intervals to the same
value of 0.0 second, which defaults the TempScan/1100 acquisition to fast mode.
• Line 13: The Set Trigger Configuration (
T
) command sets up the Trigger (trigger start event ) and
Stop (trigger stop event) parameters for the acquisition. In this example, the Trigger is assigned the
Trigger On (
@
) command character as sent by the controller, while the Stop is assigned to Count. Both
the Auto Re-arm flag and the synchronization flag are disabled, as described in previous examples.
When the TempScan/1100 encounters the Execute (
X
) command, it will be armed and will start the
collection of the Pre-Trigger data.
• Lines 14-23: After the last Execute (
X
) command has been received, the TempScan/1100 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 TempScan/1100. A
SPOLL
value of 2 signifies that the
TempScan/1100 has detected the Trigger.
• Lines 24-29: 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 30: Before reading the data, the Set Data Format (
F
) command is sent, instructing the
TempScan/1100 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 31-38: During the acquisition or after the acquisition has been completed, the buffer can be
queried for the data 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 in the
return string as an indicator of how much data is available to transfer to the IEEE 488 controller. The
function
MID$
extracts 6 characters from the string
U$
starting at character 8.
• Lines 39-48: 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 TempScan/1100 to supply the oldest complete Trigger Block of data that is currently available.
• Line 49: At the completion of the DMA transfer, the integer data is now in the buffer
BUFFER%
. To
convert the integer data into temperatures, a simple calculation is performed.