Advantech Carbon Monoxide Alarm PCI-1718 Series User Manual

Page of 94
PCI-1718 Series User Manual
46
1.
Set the input range for each A/D channel
2.
Set the input channel by specifying the MUX scan range
3.
Set pacer rate and interrupt service routine (ISR)
4.
Enable FIFO to generate interrupts and system to accept interrupts
5.
Trigger the A/D conversion by writing “1” to the A/D control 
register (BASE+9)
6.
Interrupts generate by FIFO when FIFO is half-full.
7.
Read data from the A/D converter by reading the FIFO A/D data 
register (BASE+17 and BASE+18)
8.
Convert the binary A/D data to an integer.
Example Code:
/**********This code supports TurboC 3.0 or later versions********/
#include <stdio.h>
#include <DOS.h>
void interrupt isr(void);
#define AD_NO 4096;
int iflag;
int base_addr;
void main(void)
{
    int ad_lb,ad_hb;
    int i=1; 
    int k=0; //FIFO index
    /****** Access your base address ******/
                    Add you code here
    /*******************************************/
// Set Software Trigger and Disable Nor INT 
    outportb(base_addr+0x09,0x00);