Chapter 3 Programming Your Universal Counter for Remote Operation

Elements of SCPI Commands

 

 

To Use Macros (HP BASIC)

10

USER 1

KEYS

20

ON KEY

1 LABEL " Macro Free ",1 CALL Macro_free

30ON KEY 2 LABEL " Enable Macros",1 CALL Macro_enable

40ON KEY 3 LABEL " Display Macros",1 CALL Display_macros

50

ON KEY 4 LABEL " Macro Query",1 CALL Macro_query

60ON KEY 5 LABEL " Define Macro",1 CALL Define_macro

70ON KEY 6 LABEL " Delete Macro",1 CALL Delete_macro

80

ON KEY 7 LABEL " Send

Macro",1 CALL Send_macros

90ON KEY 8 LABEL " Disable Macros",1 CALL Disable_macro

100Loop_h:GOTO Loop_h

110END

120 SUB Macro_free

! Display memory available for macros.

130OUTPUT 703;":MEM:FREE:MACRO?"

140ENTER 703;Macro_free

150DISP "Macro memory free = ";Macro_free

160LOCAL 703

170SUBEND

180 SUB Macro_enable

! Enable macros. Default is disabled

190OUTPUT 703;"*EMC 1"

200DISP "Macros Enabled!"

210LOCAL 703

220SUBEND

230 SUB Disable_macro

! Disable macros.

240OUTPUT 703;"*EMC 0"

250DISP "Macros Disabled!"

260SUBEND

270

SUB Display_macros

! Display available macros.

280

CLEAR SCREEN

 

290DIM Macros$[6500]

300OUTPUT 703;"*LMC?"

310ENTER 703;Macros$

320PRINT

330PRINT "The following macros are available:"

340PRINT

350PRINT Macros$

360SUBEND

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]

410LINPUT "Enter the name of the macro",Name$

420IF Name$="" THEN SUBEXIT

430OUTPUT 703;"*GMC? "&CHR$(39)&Name$&CHR$(39)

440ENTER 703;Macro$

450PRINT

460PRINT "Macro ";Name$;" is defined as follows:"

470PRINT

480PRINT Macro$

490LINPUT "Enter the macro name and commands to be sent",Send$

500OUTPUT 703;Send$

510SUBEND

Programming Guide

3-75