Hi all!

I need your help. I'm looking for the way to get voltage of batteries in
micaz under T2.1. I've found this code in:

http://mail.millennium.berkeley.edu/pipermail/tinyos-devel/2006-June/001220.html

----------------------------------------------------------------------------
For VoltageC.nc:

/**
 * Battery Voltage. The returned value represents the difference
 * between the battery voltage and V_BG (1.23V). The formula to convert
 * it to mV is: 1223 * 1024 / value.
 */

generic configuration VoltageC()
{
  provides interface Read<uint16_t>;
}

implementation
{
  components new AdcReadClientC(), VoltageP;

  Read = AdcReadClientC;

  AdcReadClientC.Atm128AdcConfig -> VoltageP;
}

----------------------------------------------------------------------------

For VoltageP.nc

module VoltageP
{
  provides interface Atm128AdcConfig;
}

implementation
{
  async command uint8_t Atm128AdcConfig.getChannel()
  {
    return 30; // select the 1.23V (V_BG). Reference: Table 97, page 244
from the Atmega128
  }

  async command uint8_t Atm128AdcConfig.getRefVoltage()
  {
    return ATM128_ADC_VREF_OFF;
  }

  async command uint8_t Atm128AdcConfig.getPrescaler()
  {
    return ATM128_ADC_PRESCALE;
  }
}

Copied in "/tos/platforms/micaz" and wired in my application .But It don't
compile

Please. can someone tell me how i can do it?

Thanks a lot.

Regards

-- 
Daniel GarcĂ­a Aubert
Universidad Carlos III de Madrid.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to