ads8320.h File Reference

Go to the source code of this file.

Defines

#define ADS8320_CLK   PIN_B6
#define ADS8320_CS   PIN_B5
#define ADS8320_DOUT   PIN_B7

Functions

float convert_to_volts (long data)
void init_ext_adc ()
long read_ext_adc ()


Define Documentation

#define ADS8320_CLK   PIN_B6
 

Definition at line 21 of file ads8320.h.

Referenced by init_ext_adc(), and read_ext_adc().

#define ADS8320_CS   PIN_B5
 

Definition at line 23 of file ads8320.h.

Referenced by init_ext_adc(), and read_ext_adc().

#define ADS8320_DOUT   PIN_B7
 

Definition at line 22 of file ads8320.h.

Referenced by read_ext_adc().


Function Documentation

float convert_to_volts long  data  ) 
 

Definition at line 59 of file ads8320.h.

00059                                   {
00060 
00061    return ((float)data*5.0/0xffff);
00062 }

void init_ext_adc  ) 
 

Definition at line 28 of file ads8320.h.

References ADS8320_CLK, and ADS8320_CS.

00028                     {
00029    output_high(ADS8320_CS);
00030    output_high(ADS8320_CLK);
00031 }

long read_ext_adc  ) 
 

Definition at line 34 of file ads8320.h.

References ADS8320_CLK, ADS8320_CS, and ADS8320_DOUT.

00034                     {
00035    int i;
00036    long data;
00037 
00038    data=0;
00039    output_low(ADS8320_CS);
00040    for(i=0;i<=5;i++)             // take sample and send start bit
00041    {
00042       output_low(ADS8320_CLK);
00043       delay_us(1);
00044       output_high(ADS8320_CLK);
00045       delay_us(1);
00046    }
00047    for(i=0;i<16;++i) {           // send sample over spi
00048       output_low(ADS8320_CLK);
00049       delay_us(1);
00050       shift_left(&data,2,input(ADS8320_DOUT));
00051       output_high(ADS8320_CLK);
00052       delay_us(1);
00053    }
00054    
00055    output_high(ADS8320_CS);
00056    return(data);
00057 }


Generated on Tue Nov 30 09:16:48 2004 for Smart-Its Headers by  doxygen 1.3.9.1