Hi,
Guys I am trying to attach a light-to-voltage sensor to my atmega128 based
custom node. In order to use this i need to activate the ADC and I have been
unable to do so up till now. When I checked the Sense application for
telosb, it uses the VoltageC which inturn uses the Sensor Specific code of
the MCU.
I wrote the following for my sensor: atmADCP
#include "Atm128Adc.h"
module atmADCP {
provides interface Atm128AdcConfig;
}
implementation {
const Atm128Adcsra_t config = {
adps: ATM128_ADC_PRESCALE;
adie: ATM128_ADC_INT_ENABLE_OFF;
adif: ATM128_ADC_INT_FLAG_OFF;
adfr: ATM128_ADC_FREE_RUNNING_OFF;
adsc: ATM128_ADC_START_CONVERSION_ON;
aden: ATM128_ADC_ENABLE_OFF;
};
async command uint8_t Atm128AdcConfig.getChannel()
{
return ATM128_ADC_SNGL_ADC1;
}
async command uint8_t Atm128AdcConfig.getRefVoltage()
{
return ATM128_ADC_VREF_AVCC;
}
async command uint8_t Atm128AdcConfig.getPrescalar()
{
return ATM128_ADC_PRESCALE;
}
}
atmADCC:
generic configuration atmADCC() {
provides interface Read<uint16_t>;
}
implementation {
components new AdcReadClientC();
Read = AdcReadClientC;
components atmADCP;
AdcReadClientC.Atm128AdcConfig -> atmADCP;
}
I have connected the sensor at pin 60(ADC1) but when i install the code onto
the node, the LEDs start to flash without any order, kindly help me with
this.
Regards,
Farooq Sultan
--
View this message in context:
http://www.nabble.com/ADC-Problems-tp24789889p24789889.html
Sent from the TinyOS - Help mailing list archive at Nabble.com.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help