From 070aae08a0599fabd7ee6b46a91be83e6f313d50 Mon Sep 17 00:00:00 2001 From: smckown Date: Tue, 16 Sep 2008 21:22:25 +0000 Subject: [PATCH] ADC functionality still questionable. --- .../tmirws/sensors/{BattAdcC.nc => BatteryAdcC.nc} | 10 +++++----- .../tmirws/sensors/{BattAdcP.nc => BatteryAdcP.nc} | 14 +++++++++++--- tos/platforms/tmirws/sensors/PyranometerAdcP.nc | 9 +++++++-- 3 files changed, 23 insertions(+), 10 deletions(-) rename tos/platforms/tmirws/sensors/{BattAdcC.nc => BatteryAdcC.nc} (91%) rename tos/platforms/tmirws/sensors/{BattAdcP.nc => BatteryAdcP.nc} (84%) diff --git a/tos/platforms/tmirws/sensors/BattAdcC.nc b/tos/platforms/tmirws/sensors/BatteryAdcC.nc similarity index 91% rename from tos/platforms/tmirws/sensors/BattAdcC.nc rename to tos/platforms/tmirws/sensors/BatteryAdcC.nc index aa0a90a4..d600a5ba 100644 --- a/tos/platforms/tmirws/sensors/BattAdcC.nc +++ b/tos/platforms/tmirws/sensors/BatteryAdcC.nc @@ -35,7 +35,7 @@ * @author R. Steve McKown */ -generic configuration BattAdcC() { +generic configuration BatteryAdcC() { provides interface Read; provides interface ReadStream; @@ -49,13 +49,13 @@ implementation { components new AdcReadStreamClientC(); ReadStream = AdcReadStreamClientC; - components BattAdcP; - AdcReadClientC.AdcConfigure -> BattAdcP; - AdcReadStreamClientC.AdcConfigure -> BattAdcP; + components BatteryAdcP; + AdcReadClientC.AdcConfigure -> BatteryAdcP; + AdcReadStreamClientC.AdcConfigure -> BatteryAdcP; components new AdcReadNowClientC(); Resource = AdcReadNowClientC; ReadNow = AdcReadNowClientC; - AdcReadNowClientC.AdcConfigure -> BattAdcP; + AdcReadNowClientC.AdcConfigure -> BatteryAdcP; } diff --git a/tos/platforms/tmirws/sensors/BattAdcP.nc b/tos/platforms/tmirws/sensors/BatteryAdcP.nc similarity index 84% rename from tos/platforms/tmirws/sensors/BattAdcP.nc rename to tos/platforms/tmirws/sensors/BatteryAdcP.nc index 08c0b064..7a4f4489 100644 --- a/tos/platforms/tmirws/sensors/BattAdcP.nc +++ b/tos/platforms/tmirws/sensors/BatteryAdcP.nc @@ -35,17 +35,25 @@ #include "Msp430Adc12.h" -module BattAdcP { +module BatteryAdcP { provides interface AdcConfigure; } implementation { - + /* TODO: The internal references are unsable, varying by more than 0.1V and + * jumping around. The external reference of 2.50V seems stable. + */ const msp430adc12_channel_config_t config = { inch: INPUT_CHANNEL_A0, +#if 0 /* internal references unstable */ sref: REFERENCE_VREFplus_AVss, ref2_5v: REFVOLT_LEVEL_1_5, + ref2_5v: REFVOLT_LEVEL_2_5, +#else /* external reference is stable */ + sref: REFERENCE_VeREFplus_AVss, + ref2_5v: REFVOLT_LEVEL_1_5, +#endif adc12ssel: SHT_SOURCE_ADC12OSC, - adc12div: SHT_CLOCK_DIV_1, + adc12div: SHT_CLOCK_DIV_8, sht: SAMPLE_HOLD_8_CYCLES, sampcon_ssel: SAMPCON_SOURCE_ACLK, sampcon_id: SAMPCON_CLOCK_DIV_1 diff --git a/tos/platforms/tmirws/sensors/PyranometerAdcP.nc b/tos/platforms/tmirws/sensors/PyranometerAdcP.nc index 11e8ad37..6fd9b3ed 100644 --- a/tos/platforms/tmirws/sensors/PyranometerAdcP.nc +++ b/tos/platforms/tmirws/sensors/PyranometerAdcP.nc @@ -39,13 +39,18 @@ module PyranometerAdcP { provides interface AdcConfigure; } implementation { - const msp430adc12_channel_config_t config = { inch: INPUT_CHANNEL_A3, +#if 0 /* internal references unstable */ sref: REFERENCE_VREFplus_AVss, ref2_5v: REFVOLT_LEVEL_1_5, + ref2_5v: REFVOLT_LEVEL_2_5, +#else /* external reference is stable */ + sref: REFERENCE_VeREFplus_AVss, + ref2_5v: REFVOLT_LEVEL_1_5, +#endif adc12ssel: SHT_SOURCE_ADC12OSC, - adc12div: SHT_CLOCK_DIV_1, + adc12div: SHT_CLOCK_DIV_8, sht: SAMPLE_HOLD_8_CYCLES, sampcon_ssel: SAMPCON_SOURCE_ACLK, sampcon_id: SAMPCON_CLOCK_DIV_1 -- 2.39.2