cleaned file.

This commit is contained in:
nvt-se 2007-06-28 14:07:02 +00:00
parent b88e6642bd
commit ff04b5e153

View File

@ -39,37 +39,51 @@
#include <io.h>
#include <signal.h>
#include <msp430/adc12.h>
#include "contiki-msb430.h"
void
adc_init(void) {
//Setup ADC12, ref., sampling time, REFON for DAC!!
ADC12CTL0 = SHT0_15 + SHT1_15 + MSC;
adc_init(void)
{
ADC12CTL0 = SHT0_15 | SHT1_15 | MSC;
// Use sampling timer, repeat-sequence-of-channels
ADC12CTL1 = SHP + CONSEQ_3 + CSTARTADD_0;
ADC12MCTL0 = INCH_0 + SREF_0; // P60: AIN0
ADC12MCTL1 = INCH_0 + SREF_0; // P60: AIN0
ADC12MCTL2 = INCH_0 + SREF_0; // P60: AIN0
ADC12MCTL3 = INCH_1 + SREF_0; // P61: AIN1
ADC12MCTL4 = INCH_1 + SREF_0; // P61: AIN1
ADC12MCTL5 = INCH_1 + SREF_0; // P61: AIN1
ADC12MCTL6 = INCH_2 + SREF_0; // P62: AIN2
ADC12MCTL7 = INCH_2 + SREF_0; // P62: AIN2
ADC12MCTL8 = INCH_2 + SREF_0; // P62: AIN2
ADC12MCTL9 = INCH_2 + SREF_0; // P62: AIN2
ADC12MCTL10 = INCH_3 + SREF_0; // P63: AIN2
ADC12MCTL11 = INCH_4 + SREF_0; // P64: AIN3
ADC12MCTL12 = INCH_5 + SREF_0; // P65: AIN4
ADC12MCTL13 = INCH_10 + SREF_0 + EOS; // Temp diode
/*
* SHP: sampling timer
* CONSEQ3: repeat sequence of channels
* CSTARTADD: conversion start address 0
*/
ADC12CTL1 = SHP | CONSEQ_3 | CSTARTADD_0;
/* P60: A0 */
ADC12MCTL0 = INCH_0 | SREF_0;
ADC12MCTL1 = INCH_0 | SREF_0;
ADC12MCTL2 = INCH_0 | SREF_0;
/* P61: A1 */
ADC12MCTL3 = ADC12MCTL4 = ADC12MCTL5 = INCH_1 | SREF_0;
/* P62: A2 */
ADC12MCTL6 = ADC12MCTL7 = ADC12MCTL8 = ADC12MCTL9 = INCH_2 | SREF_0;
/* P63: A3 */
ADC12MCTL10 = INCH_3 | SREF_0;
/* P64: A4 */
ADC12MCTL11 = INCH_4 | SREF_0;
/* P65: A5 */
ADC12MCTL12 = INCH_5 | SREF_0;
/* INCH10: Temperature sensor. */
ADC12MCTL13 = INCH_10 | SREF_0 | EOS;
}
void
adc_on(void)
{
ADC12CTL0 |= ADC12ON;
clock_delay(600);
clock_delay(20000);
ADC12CTL0 |= ENC;
ADC12CTL0 |= ADC12SC;
}
@ -78,6 +92,6 @@ void
adc_off(void)
{
ADC12CTL0 &= ~ENC;
clock_delay(600);
clock_delay(20000);
ADC12CTL0 &= ~ADC12ON;
}