Appendix D ChartScan Program Examples
ChartScan User’s Manual D-15
'find the pointer to DataBuffer$ for DMA transfer
buffseg% = VARSEG(DataBuffer$)
DX% = VARPTR(DataBuffer$)
buffoff% = FNPEEKW(DX% + 2)
'Program the ChartScan to power on with Factory default
PRINT #1, "CLEAR 07"
PRINT #1, "OUTPUT 07;*S1X"
'Reset ChartScan and make sure it is ready
CLS : PRINT "The ChartScan is resetting.."
PRINT #1, "OUTPUT 07;*RX"
SLEEP 3
WHILE (sp% AND 4) = 0
PRINT #1, "SPOLL 07"
INPUT #2, sp%
WEND
'Setup SRQ handling
ON PEN GOSUB UploadHandler
PEN ON
PRINT #1, "ARM SRQ"
'Program ChartScan to assert an SRQ on a Buffer 75% Full condition
PRINT #1, "OUTPUT 07;N64XM32X"
'Setup the ChartScan for line cycle integration mode
PRINT #1, "OUTPUT 07;M#0X"
PRINT #1, "OUTPUT 07;W#32X"
'Setup ChartScan for 12 channels TC type T
PRINT #1, "OUTPUT 07;C1-12,14X"
'Program Scan Counts and a fast timebase
PRINT #1, "OUTPUT 07;Y0,1,0X"
PRINT #1, "OUTPUT 07;I00:00:00.0,00:00:00.0X"
'Program a trigger start on @ and stop on @
PRINT #1, "OUTPUT 07;Q7,0,0,0,0X T1,1,0,0X"
'Wait for trigger event and Acquisition complete
PRINT "Hit a key to start a trigger event ..": WHILE INKEY$ = "": WEND
PRINT #1, "output07;@X"
WHILE (s% AND 2) <> 2
PRINT #1, "SPOLL 07"
INPUT #2, s%
WEND
PRINT "A Start Trigger has been detected.."
'Set data format to Binary
PRINT #1, "OUTPUT 07;F0,1X"
PRINT "Waiting for 75% Full..": PRINT
c = CSRLIN
WHILE INKEY$ = ""
LOCATE c - 1, 1: PRINT TIME$
WEND
CLOSE
END
UploadHandler:
PRINT #1, "DISARM SRQ"