ChartScan Program Examples Appendix D
D-4 ChartScan User’s Manual
The T command sets up the trigger parameters for the acquisition. In this example, the start event is an ‘@
character sent by the controller, and the stop event is also an ‘@’ character. 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,1,0,0X”
The next four lines, prompt you to hit a key to trigger the ChartScan. When a key is hit, the ‘@’ character is
sent, which is the system’s start event.
PRINT“The ChartScan is collecting pre-triggered data and is
ready for a trigger..”
PRINT“Press a key to trigger the start of Acquisition..”
WHILE INKEY$ = “”: WEND
PRINT #1, “OUTPUT 07;@X”
While in the post-trigger state, our application will first check for a scan to be available by serial polling the
device and comparing the response with an 8. If a scan is available, the R1 command tells the ChartScan to
send the oldest scan to the controller. ENTER requests the response data from the device. QuickBASIC’s
INPUT command places the retrieved data into the variable READINGS$.
Note that the program can go to other “foreground” tasks while ChartScan is acquiring data, and only
occasionally query the unit and collect its data. This is possible since the acquisition is slow, and
ChartScan’s buffer can be relatively large.
‘Upload data as it becomes available
PRINT “The program is currently collecting data as it becomes available..”
PRINT “Hit a key to stop Acquisition ..”
i = 0
WHILE INKEY$ = ‘’
i = i + 1
S% = 0
WHILE ((s% and 8) <>8) ‘Is scan available?
PRINT #1, “SPOLL 07"
INPUT #2, S%
WEND
PRINT #1, “OUTPUT 07;R1X” ‘Ask for one scan
PRINT#1, “ENTER 07"
INPUT#2, READING$
LOCATE7, 1: PRINT “The scan”; i; “was::”; READING$
WEND
After a key has been pressed, the program proceeds to the next block where the ‘@’ character is issued
again, ending the post-trigger state and entering the post-stop state.
PRINT #1, “OUTPUT 07;@X”
Now the collection of the post-stop data begins by querying for new scans and requesting the data. The
program is done when the acquisition is complete.
i=0
WHILE INKEY$=""
i=i+1
s%=0
WHILE ((S% AND 8) <> 8)
PRINT #1, “SPOLL07"
INPUT #2, S%
WEND
PRINT #1, “OUTPUT07;R1X”
PRINT #1, ENTER 07"
INPUT #2, READING$
LOCATE 7, 1:PRINT “The scan ”;i:was:’; READING$
PRINT #1, “OUTPUT07;UOX:
PRINT #1, :ENTER07"
OUTPUT #2, U%
if U%=1 then END
WEND