Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Programming Guide 3-75
To Use Macros (HP BASIC)
10 USER 1 KEYS
20 ON KEY 1 LABEL " Macro Free ",1 CALL Macro_free
30 ON KEY 2 LABEL " Enable Macros",1 CALL Macro_enable
40 ON KEY 3 LABEL " Display Macros",1 CALL Display_macros
50 ON KEY 4 LABEL " Macro Query",1 CALL Macro_query
60 ON KEY 5 LABEL " Define Macro",1 CALL Define_macro
70 ON KEY 6 LABEL " Delete Macro",1 CALL Delete_macro
80 ON KEY 7 LABEL " Send Macro",1 CALL Send_macros
90 ON KEY 8 LABEL " Disable Macros",1 CALL Disable_macro
100 Loop_h:GOTO Loop_h
110 END
120 SUB Macro_free ! Display memory available for macros.
130 OUTPUT 703;":MEM:FREE:MACRO?"
140 ENTER 703;Macro_free
150 DISP "Macro memory free = ";Macro_free
160 LOCAL 703
170 SUBEND
180 SUB Macro_enable ! Enable macros. Default is disabled
190 OUTPUT 703;"*EMC 1"
200 DISP "Macros Enabled!"
210 LOCAL 703
220 SUBEND
230 SUB Disable_macro ! Disable macros.
240 OUTPUT 703;"*EMC 0"
250 DISP "Macros Disabled!"
260 SUBEND
270 SUB Display_macros ! Display available macros.
280 CLEAR SCREEN
290 DIM Macros$[6500]
300 OUTPUT 703;"*LMC?"
310 ENTER 703;Macros$
320 PRINT
330 PRINT "The following macros are available:"
340 PRINT
350 PRINT Macros$
360 SUBEND
370 SUB Send_macros ! Send a macro command to the counter.
380 CLEAR SCREEN ! A list of macros to choose from is
390 CALL Display_macros ! shown on the computer.
400 DIM Name$[25],Macro$[200],Send$[255]
410 LINPUT "Enter the name of the macro",Name$
420 IF Name$="" THEN SUBEXIT
430 OUTPUT 703;"*GMC? "&CHR$(39)&Name$&CHR$(39)
440 ENTER 703;Macro$
450 PRINT
460 PRINT "Macro ";Name$;" is defined as follows:"
470 PRINT
480 PRINT Macro$
490 LINPUT "Enter the macro name and commands to be sent",Send$
500 OUTPUT 703;Send$
510 SUBEND