User`s manual

CHAPTER 4 PROGRAMMING TECBNIQUES
49
4.6. Interrupt Handling
10 'FILE NAME : EXAMPLE.6
20 'Program Example : INTERRUPT HANDLING
30 '
40 'Purpose : This program measures 100 voltage readings and
50 'displays them. It also goes to service
60 'subroutines when interrupts happen.
70 '
80 'Remark : The interrupt handing is for the Advanced BASIC
90 'Version A3.00 and higher only. For other BASIC
100 'Version, this may ont work because of the
110 'different memory arrangement.
120 'This program is written for the HP3478A DVM. If
130 'other models of voltmeters are used, please
140 'check the operating manual and make necessary ;
150 'modification to this program.
160 In this example, the program only shows when the
170 'interrupt happens. You can add more actions to
180 'the service routine to response to an interrupt.
190 '
200 'Initialization
210 '
220 CLS
230 DEF SEG=&HD000 240 ABORT%=9 : ENTER%=6 : OUTPUT%=3 :
STATUS%=42 : TRIGGER%=48 250 SPOLL%=39 : DEVCLR%=15
260 INIT%=0
270 IOPORT%=&H2B8 : MYADDR%=21 E
280 SETTING%=&HE1C ‘ Enable Bus Error, Timeout & select IRQ7
290 'for SRQ interrupt
300 CALL INIT%(IOPORT%,MYADDR%,SETTING%)
310 '
320
330 'Set the DVM & UNMASK Front Panel SRQ bit
340 '
350 ADDR%=23
360 CALL DEVCLR%(ADDR%)
370 FOR II=1 TO 1000 : NEXT II
380 D$=”KM20FlT3RAN5"
390 CALL OUTPUT%(ADDR%,DS) ‘ Send instrument setting string .
400 '
410 ON ERROR GOTO 580
420 ON KEY(l9) GOSUB 700 : KEY(l9) ON
430 ON KEY(20) GOSUB 770 : KEY(20) ON
440
450