Advantech PCI-1718 Manual do Utilizador Página 50

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 94
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 49
PCI-1718 Series User Manual 42
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 device 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 the device when the A/D conversion is
completed.
7. Read data from the A/D converter by reading the A/D data register
(BASE+0 and BASE+1)
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; //Number of Samples
int iflag;
int base_addr;
void main(void)
{
int ad_lb,ad_hb; //Declaration
int i=1;
/****** Access your base address ******/
Add you code here
/*******************************************/
outportb(base_addr+9,0x00); //Set Software Trigger and Disable INT.
outportb(base_addr+2,0x00); //Mux Scan Channel Control
outportb(base_addr+1,0x00); //A/D Range Control
Vista de página 49
1 2 ... 45 46 47 48 49 50 51 52 53 54 55 ... 93 94

Comentários a estes Manuais

Sem comentários