]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Clean up the ADC configuration for the wind vane.
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Wed, 4 Nov 2009 03:55:03 +0000 (03:55 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:01:45 +0000 (20:01 -0700)
tos/platforms/tmirws/sensors/WindVaneAdcP.nc

index e898db0fa41bc0eb8133ff30eb0f022a9b36b085..67f019df5f7404c979dd95cb62064a0ecc1644ce 100644 (file)
@@ -47,31 +47,24 @@ module WindVaneAdcP {
   provides interface AdcConfigure<const msp430adc12_channel_config_t*>;
 }
 implementation {
-  /* TODO: The internal references are unsable, varying by more than 0.1V and
-   * jumping around.  The external reference of 2.50V seems stable.
+  /* We use the external reference because it is probably more accurate (see
+   * the circuit), and there is no arbitration for the voltage reference.  With
+   * the external reference, we can ReadStream 4 data points in 420 us.  Using
+   * the internal reference, this time increases significantly to over 18 ms.
    */
   const msp430adc12_channel_config_t config = {
       inch: INPUT_CHANNEL_A2,
-#if 1 /* internal references unstable (no, I don't think so) */
-      sref: REFERENCE_VREFplus_AVss,
-      ref2_5v: /*REFVOLT_LEVEL_1_5, */ REFVOLT_LEVEL_2_5,
-#else /* external reference is stable, and is 2.5V */
       sref: REFERENCE_VeREFplus_AVss,
-      ref2_5v: REFVOLT_LEVEL_1_5, 
-#endif
-#if 0 /* clock source doesn't seem to affect stability */
+      ref2_5v: REFVOLT_LEVEL_1_5, /* doesn't matter since external ref used */
       adc12ssel: SHT_SOURCE_ADC12OSC,
       adc12div: SHT_CLOCK_DIV_8,
-#else
-      adc12ssel: SHT_SOURCE_ACLK,
-      adc12div: SHT_CLOCK_DIV_1,
-#endif
       sht: SAMPLE_HOLD_8_CYCLES,
       sampcon_ssel: SAMPCON_SOURCE_ACLK,
       sampcon_id: SAMPCON_CLOCK_DIV_1
   };
   
-  async command const msp430adc12_channel_config_t* AdcConfigure.getConfiguration()
+  async command const msp430adc12_channel_config_t*
+    AdcConfigure.getConfiguration()
   {
     return &config;
   }