
Sample Program
5-5
IM 704310-12E
5
5.5
Example of Output in ASCII Format
'*********************************************************************
'* *
'* TA520 Sample Program4 for GP-IB interface *
'* Microsoft QuickBASIC 4.0/4.5 Version *
'* *
'*********************************************************************
'*
*
'* Outputs the data measured in time stamp mode in ASCII format. *
'*
*
'*********************************************************************
'
REM $INCLUDE: 'qbdecl4.bas'
'
DEVICE$ = "DEV1": CALL IBFIND(DEVICE$, TA%)
CALL IBSIC(TA%)
BORD$ = "GPIB0": CALL IBFIND(BORD$, BD%)
CALL IBSIC(BD%)
V% = 1: CALL IBSRE(BD%, V%)
CALL IBCLR(TA%)
'
CMD$ = "MEASURE:MODE TSTAMP"
'Hardware histogram mode
CALL IBWRT(TA%, CMD$)
CMD$ = "MEASURE:FUNCTION TI,AB"
'Time interval measurement
CALL IBWRT(TA%, CMD$)
CMD$ = "SAMPLE:GATE:MODE EVENT"
'Event gate
CALL IBWRT(TA%, CMD$)
CMD$ = "SAMPLE:GATE:EVENTSIZE 1000"
'Sampling size to 1000 points
CALL IBWRT(TA%, CMD$)
'
CMD$ = "STATUS:FILTER1 RISE"
'Set transition filter
CALL IBWRT(TA%, CMD$)
CMD$ = "STATUS:EESR?"
'Clear extended event register
CALL IBWRT(TA%, CMD$)
RES$ = SPACE$(100)
CALL IBRD(TA%, RES$)
'
CMD$ = "SSTART"
'Start single measurement
CALL IBWRT(TA%, CMD$)
CMD$ = "COMMUNICATE:WAIT 1"
'Wait for measured data to become valid
CALL IBWRT(TA%, CMD$)
'
CMD$ = "MEMORY:DATASELECT MEASUREDATA"
'Set the type of data to retrieve
CALL IBWRT(TA%, CMD$)
CMD$ = "MEMORY:FORMAT ASCII"
'Set the format
CALL IBWRT(TA%, CMD$)
'
ST% = 1: ED% = 1000
'Set the start and end points
FOR I% = ST% TO ED% STEP 10
'Retrieve 10 points at a time
CMD$ = "MEMORY:START" + STR$(I%) + ";END" + STR$(I% + 9)
CALL IBWRT(TA%, CMD$)
CMD$ = "MEMORY:SEND?"
'Request measured data
CALL IBWRT(TA%, CMD$)
RES$ = SPACE$(250)
CALL IBRD(TA%, RES$)
'Receive measured data
J% = 1
FOR K% = 0 TO 9
D# = VAL(MID$(RES$, J%))
'Convert ASCII to real number
PRINT I% + K%, D#
'Display measured values
J% = INSTR(J%, RES$, ",") + 1
NEXT K%
NEXT I%
'
V% = 0: CALL IBSRE(BD%, V%)
'
END
Output Example
1 .000000024075
2 .0000000259
3 .000000027850
4 .000000024225
5 .000000030625
6 .000000026425
7 .00000002
8 .0000000322
9 .00000002785
10 .0000000268
: :
5.5 Example of Output in ASCII Format