Chapter 3 Programming Your Universal Counter for Remote Operation

Elements of SCPI Commands

To Use Macros (QuickBASIC) (Continued)

ON KEY(1) GOSUB availablememory

 

ON KEY(2) GOSUB enablemacro

 

ON KEY(3) GOSUB displaymacro

 

ON KEY(4) GOSUB querymacro

 

ON KEY(5) GOSUB definemacro

 

ON KEY(6) GOSUB deletemacro

 

ON KEY(7) GOSUB purgemacro

 

ON KEY(8) GOSUB disablemacro

 

ON KEY(9) GOSUB sendmacro

 

ON KEY(10) GOSUB quit

 

loophere: GOTO loophere

'Wait for function key to be pressed

availablememory:

'Display available macro memory

CALL sendhp(":MEM:FREE:MACRO?")

 

CALL IOENTER(source&, freemacro)

 

PRINT "Available macro memory = "; freemacro

RETURN

 

enablemacro:

'Enable all macros

sendhp ("*EMC 1")

 

PRINT "Macros Enabled"

 

RETURN

 

displaymacro:

'Display macros available in counter

CLS

 

sendhp ("*LMC?")

CALL IOENTERS(source, results$, maxlength, actual) macros$ = LEFT$(results$, actual)

PRINT "The following macros are available:" PRINT macros$

RETURN

querymacro:

'Ask for definition of a macro

CLS

 

GOSUB displaymacro

 

INPUT "Enter the name of the macro you want to see ", namemacro$ IF namemacro$ = "" THEN RETURN

sendhp ("*GMC? " + CHR$(39) + namemacro$ + CHR$(39)) CALL IOENTERS(source, results, maxlength, actual) macroname$ = LEFT$(results, actual)

PRINT namemacro$; " is defined as:" PRINT macroname$

RETURN

deletemacro:

'Delete a macro

GOSUB displaymacro

 

INPUT "Enter the name of the macro you want to delete ", namemacro$ IF namemacro$ = "" THEN RETURN

sendhp ("MEM:DELETE:MACRO " + CHR$(39) + namemacro$ + CHR$(39))

RETURN

Programming Guide

3-89