2-45
Sample Programs
Listings of the Sample Programs
390 CLEAR @Scope
400 OUTPUT @Scope;"*RST"
410 OUTPUT @Scope;"*CLS"
420 OUTPUT @Scope;":SYSTem:HEADer OFF"
430 OUTPUT @Scope;":AUToscale"
440 SUBEND
450 !
460 !
470 !
480 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
490 !
500 ! Subprogram name: Setup_srq
510 ! Parameters: none
520 ! Return value: none
530 ! Description: This routine sets up the scope to generate Service Requests.
540 ! It sets the Service Request Enable Register Event Status Bit
550 ! and the Standard Event Status Enable REgister to allow SRQs on
560 ! Command or Query errors.
570 !
580 !
590 SUB Setup_srq
600 COM /Io/@Scope,Interface
610 OUTPUT @Scope;"*SRE 32" !Enable Service Request Enable Registers - Event Status bit
620 !
630 ! Enable Standard Event Status Enable Register:
640 ! enable bit 4 - Command Error - value 32
650 ! bit 1 - Query Error - value 4
660 OUTPUT @Scope;"*ESE 36"
670 SUBEND
680 !
690 !
700 !
710 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
720 !
730 !
740 ! Subprogram name: Create_srq
750 ! Parameters: none
760 ! Return value: none
770 ! Description: This routine will send an illegal command to the scope to
780 ! show how to detect and handle an SRQ. A query is sent to
790 ! the scope which is then followed by another command causing
800 ! a query interrupt error. An illegal command header is then
810 ! sent to demonstrate how to handle multiple errors in the error queue.
820 !
830 !
840 !
850 SUB Create_srq
860 COM /Io/@Scope,Interface
870 DIM Buf$[256]
880 OUTPUT @Scope;":CHANnel2:DISPlay?"
890 OUTPUT @Scope;":CHANnel2:DISPlay OFF" !send query interrupt
900 OUTPUT @Scope;":CHANnel:DISPlay OFF" !send illegal header
910 ! Do some stuff to allow time for SRQ to be recognized
920 !
930 OUTPUT @Scope;"*IDN?" !Request IDN to verify communication
940 ENTER @Scope;Buf$ !NOTE: There is a leading zero to this query response