Syncronizing Multiple MSC1210 Devices
12-23
Analog-to-Digital Converter
#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;
// 11MHz Clock
ACLK = 9;
// ACLK = 11,0592,000/10 = 1,105,920 Hz
// modclock = 1,105,920/64 = 17,280 Hz
// 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
Содержание MSC1210
Страница 1: ... December 2002 User s Guide SBAU077 ...
Страница 149: ...Digital Filter 12 13 Analog to Digital Converter Figure 12 5 Filter Frequency Responses ...
Страница 162: ...12 26 ...
Страница 234: ...Timers 17 6 Figure 17 4 Timer Counter 1 Mode 1 Figure 17 5 Interrupt System ...
Страница 273: ...Serial Port I O 17 45 Keil Simulator Figure 17 19 Clock Control Peripheral Figure 17 20 USART0 Preipheral ...
Страница 282: ...C 4 ...