Texas Instruments MSC1210 manual Analog-to-Digital Converter 12-23

Models: MSC1210

1 324
Download 324 pages 20.97 Kb
Page 159
Image 159
// 11MHz Clock
// ACLK = 11,0592,000/10 = 1,105,920 Hz // modclock = 1,105,920/64 = 17,280 Hz

Syncronizing Multiple MSC1210 Devices

#include <REG1210.H> #include <stdio.h> #include <stdlib.h> #include <math.h>

#define LSB 298.0232e−9 /* LSB=5.0/2^24 */ extern void autobaud(void);

extern long bipolar(void); void main(void)

{

float volts, temp, resistance, ratio, lr, ave; int i, k, decimation = 1728, samples; autobaud();

printf(”MSC1210 Sync Example \n”); //Timer Setup

USEC = 10;

ACLK = 9;

// Setup ADC

PDCON &= 0x0f7; // turn on adc

ADMUX = 0x01; // Select AIN0/AIN1

ADCON0 = 0x30; // Vref On, Vref Hi, Buff off, BOD off, PGA=1 ADCON2 = decimation & 0xFF; // LSB of decimation

ADCON3 =(decimation>>8) & 0x07; // MSB of decimation

ADCON1 = 0x01; // bipolar, auto, self calibration, offset, gain while(sync == 0); // As long as sync is low, wait

//Now that sync is low, shut down ADC. PDCON = 0x08;

while(sync == 1); // As long as Sync is high, wait.

//When sync goes low, turn on ADC and continue PDCON = ~0x08;

//At this point ADC is on and multiple MSC1210’s using the

//same Sync signal will be in syncronization.

}//main

Analog-to-Digital Converter

12-23

 

Page 159
Image 159
Texas Instruments MSC1210 manual Analog-to-Digital Converter 12-23