9-18 Stepping and Scanning
AsciiRdgsBuf$ = SPACE$(18 * NumRdgs)
'represents the string of buffer response
DIM Readings!(1 TO NumRdgs) 'array of the 48 individual readings in
'numerical representation form - converted from
'ASCII
CALL send(Addr, "TRACE:DATA?", status%)
'ask 2182 for the buffer response
CALL enter(AsciiRdgsBuf$, length%, Addr, status%)
'read in buffer response
' Start Parsing the data readings...
ParseLength = 1 'represents how many characters to extract from
'response string
CurrentPosition% = 1 'represents which character on in response
'string
OneReading$ = "" 'clear out string contents
ReadingOn% = 1 'represents the individual reading on
DO
OneCharacter$ = MID$(AsciiRdgsBuf$, CurrentPosition%, ParseLength)
'above line reads in the next character for the
'buffer response
IF (OneCharacter$ = ",") THEN
'found an individual reading so store it as such
Readings!(ReadingOn%) = VAL(OneReading$)
OneReading$ = "" 'clear out so able to read next individual
'reading
ReadingOn% = ReadingOn% + 1
'increment counter for next individual reading
ELSE
'still building an individual reading so add on
'the next character
OneReading$ = OneReading$ + OneCharacter$
END IF
CurrentPosition% = CurrentPosition% + 1
'increment character on in the buffer response
LOOP UNTIL (CurrentPosition% > length%)
'loop until pass the number of characters read
'in with the buffer response
Readings!(ReadingOn%) = VAL(OneReading$)
'store last individual reading since it will not
'be separated by a comma
'Calculate DataIC and DataV values
'where Chan2! is the CH2 numerical representation for string CH2 data
' and Chan1! is the CH1 numerical representation for string CH1 data
' CH1pos! is the positive portion for channel 1
' CH1neg! is the negative portion for channel 1
k% = 1 'represents the reading in Reading! to use in
'calculation