Instruction manual

AMPDIO DRIVERS
Page 39
In order to determine whether any events have occurred, use the getLongIntItem function (see
section 6.4.4.14). This returns the index of the current interrupt item in the supplied buffer. The
Item can then be read using the readLongBuf function (see section 6.4.4.6).
When finished, the TCfreeEventRecorder function (see section 6.4.7.5) frees up the resources
used so they can be used again by another service. This does not free the stopwatch or buffer.
3.4.2 Digitally Controlled Oscillator
The combination of the 82C55 PPI and 82C54 counter/timer devices make it possible to implement
a digitally controlled oscillator, whereby the value of a binary number read into a PPI input channel
is used to calculate the frequency of a square wave generated on a timer/counter output. To turn
this process into a continuous background task, a second timer/counter can be deployed to
generate an update signal by generating a periodic interrupt. The interrupt service routine then
performs the DCO operation in the background. See section 6.4.10.
Function TCsetDCO sets up such an arrangement, allowing you to specify the digital input channel,
the output timer/counter and the second timer/counter used to generate the update interrupts. The
function also allows for a flexible update rate and output frequency range. The digital input channel
width (i.e. the number of bits in the digital input word) can be selected to either 1, 4, 8, 12, 16 or 24
bits by calling function DIOsetChanWidth (see section 6.4.11.4 for more details). The PPI Port(s)
used by the digital input channel must be programmed as input by calling function DIOsetMode for
each port (see section 6.4.11.7).
The enableInterrupts and disableInterrupts functions (see sections 6.4.2.1 and 6.4.2.2) must then
be called to enable and disable the 'update' interrupts, and, when finished, function TCfreeDCO
frees up the resources used so they can be used again by another program.
When using the DCO function with the PC214E, please ensure the following connections are
made:
1. The digital input bit(s) must be connected to the digital input channel specified
2. The output timer/counter clock source must be 1 MHz
3. The 'update' timer/counter MUST BE Z1 Counter 1 on the PC214E. The clock source must be
1 MHz (i.e. jumper J3 in position 2), and the frequency specified must be within the range 15
Hz to 500 kHz.
4. The interrupt source must be Z1 Timer/Counter OUT1 (i.e. jumper 5 in position 5).
3.4.3 Interrupt Callback
The driver and DIO_TC.DLL provide a mechanism that allows an external user supplied function to
be called when an interrupt occurs. This is a very powerful mechanism. Using it, you can
implement sophisticated interrupt routines without having to write a completely new interface to the
low-level driver. A small percentage of users need this facility in order to use their Amplicon
hardware effectively.
To use this facility you must be a competent programmer with knowledge of interrupts and of using
Windows callback functions. The DLL provides an alternate mechanism that allows interrupts to be
used without callback functions, by waiting or polling for the occurrence of an interrupt.
There are a number of examples of how to use this feature:
 Examples shipped with the driver.
 Examples written in C on www.mev.co.uk/suppdio.htm.
 The TCsetEventRecorder and TCsetDCO functions in the DIO_TC.DLL source.