LTC1298.C  


Driver for LTC1298 A/D Converter

/*****************************************************************************
 *                                                                           *
 *                      Driver for LTC1298 A/D Converter                     *
 *                                                                           *
 *     adc_init()                                   Call after power up      *
 *                                                                           *
 *     value = read_analog( channel )               Read a analog channel    *
 *                                                  channel is 0 or 1        *
 *                                                                           *
 *     convert_to_volts( value,  string )           Fills in string with     *
 *                                                  the true voltage in      *
 *                                                  the form 0.000           *
 *                                                                           *
 *           (C) Copyright 1996,1997 Custom Computer Services                *
 *                                                                           *
 *****************************************************************************/
#ifndef ADC_CS

#define ADC_CLK  PIN_B0
#define ADC_DOUT PIN_B1
#define ADC_DIN  PIN_B2
#define ADC_CS   PIN_B3

#endif


void adc_init() {
   output_high(ADC_CS);
}

void write_adc_byte(byte data_byte, byte number_of_bits) {
   byte i;

   delay_us(2);
   for(i=0; i>1;
      output_high(ADC_CLK);
      delay_us(50);
      output_low(ADC_CLK);
      delay_us(50);
   }
}


byte read_adc_byte(byte number_of_bits) {
   byte i,data;

   data=0;
   for(i=0;i



Navigation Bar
tech_support@blitzlogic.com