Appendix D ChartScan Program Examples
ChartScan User’s Manual D-9
The O? query command returns the following string representing all 4 ports digital output status.
Oxxx, xxx, xxx, xxx
AlarmHandler:
LOCATE 5, 1
PRINT “An Alarm condition has been detected..”
PRINT #1, “SPOLL 07"
INPUT #2, S%
PRINT #1, “OUTPUT 07;O?X”
PRINT #1, “ENTER 07"
LINE INPUT #2, A$
PRINT A$
A% = VAL(MID$(A$, 2, 3))
IF A% = 1 THEN PRINT “Alarm on CH1 only”
IF A% = 2 THEN PRINT “Alarm on CH2 only”
IF A% = 3 THEN PRINT “Alarm on CH1 & 2 ”
RETURN

Collecting Data in Binary Format using BIN_ACQ.BAS

The following program, BIN_ACQ.BAS, in the EXAMPLES directory will set up the ChartScan then
collect the channel readings in a binary format rather than the default ASCII format. This is inherently
faster than ASCII format, but the data must be deciphered after it is collected to yield temperature values.
Although not necessary, it is good practice to reset the ChartScan at the beginning of your application by
sending it the “*R” command and then waiting a few seconds.
CLS : PRINT “The ChartScan is resetting..”
PRINT #1, “OUTPUT 07;*RX”
SLEEP 4
To be certain that the reset was successful and the device is ready, serial poll the device until the proper
status is returned.
WHILE (S% AND 4) = 0
PRINT #1, “SPOLL 07"
INPUT #2, S%
WEND
The C command will be used twice to configure a range of channels from 1 to 16 as Type J thermocouples
and a range of channels from 17 to 32 as Type K thermocouples.
PRINT #1, “OUTPUT 07;C1-16,3X”
PRINT #1, “OUTPUT 07;C17-32,2X”
The Y command is used to configure the number of scans to take while in the different acquisition states. In
this example, 400 scans are 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 valid since the stop event, set by the T command will
be set to Counted later in the program.
PRINT #1, “OUTPUT 07;Y400,100,200X”
The I command sets the time between scans in hours-minutes-seconds format. The ChartScan can have
two separate scan rates, one that is used in the post-trigger state, and one that is used in all other states.
This example sets up both scan intervals to 0.0 seconds, which is interpreted a “go as fast as possible”.
PRINT #1, “OUTPUT 07;I00:00:00.0,00:00:00.0X”
The T command is used to set the trigger, or start event, to the ‘@’ character sent by the controller. The stop
event is set to Counted. The auto-rearm flag is set to 0 (off), so that the ChartScan will not re-arm itself for
another acquisition after this acquisition is complete. The synchronization flag is also off, so the ChartScan
will not re-synchronize itself to the trigger point when the start event begins. When the ChartScan
encounters the X command, it will be armed and start the collection of the pre-trigger data.
PRINT #1, “OUTPUT 07;T1,8,0,0X”
After the ‘@’ character is sent, the IEEE 488 Serial Poll command is used to query the ChartScan as to the
status of the acquisition. A SPOLL value of 2 signifies that the ChartScan has encountered the start event.