Chapter 3 Programming Your Universal Counter for Remote Operation

Programming Examples

To Use Macros (HP BASIC) (Continued)

520 SUB Define_macro

! Define a macro for the counter

530DIM Name$[25],Macro$[200],Send$[255],Header$[2]

540CLEAR SCREEN

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

560LINPUT "Enter the counter commands",Macro$

570Length=LEN(Macro$)

580

Num_char=INT(LGT(Length))+1 ! Determine # of characters for header

590

Header$="#"&VAL$(Num_char)

600Send$="*DMC "&CHR$(39)&Name$&CHR$(39)&","&Header$&VAL$(Length)&Macro$

610OUTPUT 703;Send$

620SUBEND

630 SUB Macro_query

! Ask for the definition of a macro.

640DIM Name$[25],Macro$[255]

650CLEAR SCREEN

660CALL Display_macros

670LINPUT "Enter the name of the macro you want to see",Name$

680IF Name$="" THEN SUBEXIT

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

700ENTER 703;Macro$

710PRINT

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

730PRINT

740PRINT Macro$[(VAL(Macro$[2,2])+3)] ! Display command portion of macro

750SUBEND

760

SUB Delete_macro

! Delete a macro.

770

DIM Name$[25]

 

780

CALL Display_macros

 

790LINPUT "Enter the name of the macro you want to delete",Name$

800IF Name$="" THEN SUBEXIT

810OUTPUT 703;":MEM:DELETE:MACRO ";CHR$(39)&Name$&CHR$(39)

820SUBEND

3-76

Programming Guide