HP (Hewlett-Packard) HP 53131A Water Dispenser User Manual


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-76 Programming Guide
To Use Macros (HP BASIC) (Continued)
520 SUB Define_macro ! Define a macro for the counter
530 DIM Name$[25],Macro$[200],Send$[255],Header$[2]
540 CLEAR SCREEN
550 LINPUT "Enter the name of the macro",Name$
560 LINPUT "Enter the counter commands",Macro$
570 Length=LEN(Macro$)
580 Num_char=INT(LGT(Length))+1 ! Determine # of characters for header
590 Header$="#"&VAL$(Num_char)
600 Send$="*DMC "&CHR$(39)&Name$&CHR$(39)&","&Header$&VAL$(Length)&Macro$
610 OUTPUT 703;Send$
620 SUBEND
630 SUB Macro_query ! Ask for the definition of a macro.
640 DIM Name$[25],Macro$[255]
650 CLEAR SCREEN
660 CALL Display_macros
670 LINPUT "Enter the name of the macro you want to see",Name$
680 IF Name$="" THEN SUBEXIT
690 OUTPUT 703;"*GMC? "&CHR$(39)&Name$&CHR$(39)
700 ENTER 703;Macro$
710 PRINT
720 PRINT "Macro ";Name$;" is defined as follows:"
730 PRINT
740 PRINT Macro$[(VAL(Macro$[2,2])+3)] ! Display command portion of macro
750 SUBEND
760 SUB Delete_macro ! Delete a macro.
770 DIM Name$[25]
780 CALL Display_macros
790 LINPUT "Enter the name of the macro you want to delete",Name$
800 IF Name$="" THEN SUBEXIT
810 OUTPUT 703;":MEM:DELETE:MACRO ";CHR$(39)&Name$&CHR$(39)
820 SUBEND