Step 3: install your interrupt vector, Step 4: trigger a data acquisition cycle – Ocean Optics PC2000-PC_104 User Manual
Page 13
PC2000-PC/104 Data Sheet
Step 3: Install Your Interrupt Vector
Consult your hardware documentation to determine how to do this correctly. Below is a sample C
function, which installs the interrupt service routine using Borland C 4.0 in a DOS environment.
disable()
disable interrupts during this change
oldvect = getvect(irq + 8)
save the old interrupt vector for the IRQ
setvect(irq + 8, ihandler)
set the interrupt vector to be the address of your
interrupt handler
if irq == 2 then outport_byte(0x21,
inport_byte(0x21) & 0xfb)
unmask the correct IRQ
if irq == 3 then outport_byte(0x21,
inport_byte(0x21) & 0xf7)
unmask the correct IRQ
if irq == 5 then outport_byte(0x21,
inport_byte(0x21) & 0xdf)
unmask the correct IRQ
if irq == 7 then outport_byte(0x21,
inport_byte(0x21) & 0x7f)
unmask the correct IRQ
enable()
reenable interrupts once done changing
After disabling interrupts, we store the old interrupt vector for the IRQ in oldvect. We then set the new
interrupt vector to a function called ihandler (described below). Then, we enable a specific interrupt by
changing the interrupt mask.
Step 4: Trigger a Data Acquisition Cycle
port = baseadd + 4
identify the PC2000-PC104 control port
cmd = cmd & 0xe7
clear the channel bits
if current_channel between Master
and Slave3 then
cmd = cmd | current_channel << 3
cmd = cmd & 0x7f
else
cmd = cmd | current_channel << 3
cmd = cmd | 0x80
end if
set the A/D MUX channel. If the MUX channel is
between 0 and 3, the highest order bit for the MUX
selection is set to 0, or else it is set to 1.
CheckTriggerMode()
check the external trigger mode
outport_byte(port,cmd)
set command to PC2000-PC104
cmd = cmd & 0xbe
disable triggers and interrupts
cmd = cmd | 0x20
reset the FIFO buffer
CheckTriggerMode()
check the external trigger mode
outport_byte(port,cmd)
set command to PC2000-PC104
cmd = cmd & 0xdf
cancel the reset
CheckTriggerMode()
check the external trigger mode
000-00000-000-05-0704
13