[Tinyos-help] Problem in ADC setting ..
Ernest Andrew McCracken (emccrckn)
emccrckn at memphis.edu
Thu Jun 25 12:40:26 PDT 2009
It may be possible with two instances of AdcReadStreamClientC. I haven't tried this though. The AdCReamStreamClientC is wired to tos.chips.msp430.adc12.Msp430Adc12SingleChannel. You might want to take a look at tos.chips.msp430.adc12.Msp430Adc12MultiChannel interface which is used to read from multiple channels concurrently. What platform do you use? We use telosb and you can see the nesdocs for it at http://www.tinyos.net/tinyos-2.1.0/doc/nesdoc/telosb/
From: himanshu barve [mailto:himu.bar at gmail.com]
Sent: Thursday, June 25, 2009 1:48 PM
To: Ernest Andrew McCracken (emccrckn)
Subject: Re: [Tinyos-help] Problem in ADC setting ..
I want to monitor two channels at a time ..
its voltage and current . Only if both sample of current and voltage are at same instant (time elapsed for conversion may be ignored) is that possible with this interface ?
2009/6/26 Ernest Andrew McCracken (emccrckn) <emccrckn at memphis.edu<mailto:emccrckn at memphis.edu>>
Have you tried using AdcReadStreamClientC ? I had the same problems when using the Timer interface. However the AdcReadStreamClientC component provides ReadStream Interface which you can use for high speed sampling. You can use the same AdcConfigure settings. With the ReadStream you can do something like the following....
Task foo(){
ReadStream.postBuffer(yourSampleBuffer[]);
ReadStream.read(yourSamplingPeriod); // in usec!
}
Event readDone(err, actualSamplingPeriod){
// get values from buffer
}
20 samples per 20 millisec ( 1kHz) is easily accomplished.
From: tinyos-help-bounces at millennium.berkeley.edu<mailto:tinyos-help-bounces at millennium.berkeley.edu> [mailto:tinyos-help-bounces at millennium.berkeley.edu<mailto:tinyos-help-bounces at millennium.berkeley.edu>] On Behalf Of himanshu barve
Sent: Thursday, June 25, 2009 12:13 PM
To: Michael Schippling
Cc: tinyos-help at millennium.berkeley.edu<mailto:tinyos-help at millennium.berkeley.edu>
Subject: Re: [Tinyos-help] Problem in ADC setting ..
Thats OK. that can be done .. but what is the problem with MSP430ADC12Single interface .. the program which i have sent in previous mail is not even working for 2 ticks ..
Am i using proper settings for ADC ?
I will check for your suggestion and let u know.
2009/6/25 Michael Schippling <schip at santafe.edu<mailto:schip at santafe.edu>>
If I understand correctly your program worked with a Timer at 2 ticks,
but not at 1, right? If so check the return value of the Timer.start()
as there is a lower limit on the tick setting. It may be returning
an error and not starting. The limit used to be 3 in T1 for micas.
MS
himanshu barve wrote:
Hello Friends .. In my application , i am using two ADC channels .. I need to sample them one after other . I am giving some lines from my program concerning my problem. In this program i am trying to wire MSP430ADC12Single interface.
But its not working ..
module{
uses{
..
..
interface MSP430ADC12Single as sensor1;
interface MSP430ADC12Single as sensor2;
..
..
}
command result_t StdControl.init() {
call sensor1.bind(ADC12_SETTINGS(
INPUT_CHANNEL_A0,
REFERENCE_VREFplus_AVss,
SAMPLE_HOLD_512_CYCLES,
SHT_SOURCE_ADC12OSC,
SHT_CLOCK_DIV_1,
SAMPCON_SOURCE_SMCLK,
SAMPCON_CLOCK_DIV_1,
REFVOLT_LEVEL_1_5
));
call sensor2.bind(ADC12_SETTINGS( ssame as above except channel))
}
command result_t StdControl.start() {
call Timer.start( TIMER_REPEAT,1);
return SUCCESS;
}
event result_t Timer.fired() {
call sensor1.getData();
call sensor4.getData();
}
async event result_t sensor1.dataReady(uint16_t data1) {
atomic m_adc1 = data1;
return SUCCESS;
}
async event result_t sensor2.dataReady(uint16_t data2) {
atomic m_adc2 = data2;
call .... some function(m_adc1,m_adc2)
return SUCCESS;
}
}
--------------------------------------------------------------------
Previously the same program was running with ADC interface ..
In previous program timer was in repeat fire mode for 2 ticks. But i want it to be 1 tick .. so that i will get 20 samples per 20 milli sec . (which is one cycle for 50Hz system). Thus i tried above setting .. But its not even working .
While using ADC interface we do not bind ports as in above . we use other macro "ASSOCIATE_ADC_CHANNEL" which passes 3 parameter . Other parameters are preset in ADC interface. of which difference lies only in two settings.
instead of SAMPLE_HOLD_512_CYCLES --- SAMPLE_HOLD_4_CYCLES
instead of SHT_SOURCE_ADC12OSC,---------SHT_SOURCE_SMCLK
After discovering this all .. I tried to run previous program with changing ADC interface .. with SAMPLE_HOLD_512_CYCLES & SHT_SOURCE_ADC12OSC but that is also not working ..
Help me out of it ..!! I have tried lot of combinations .. but none is working .. What i want is fast sampling but two channels at a time ..
Thanks in advance .. (sorry if i am confusing ..!)
--
With Best Regards
Himanshu Barve
IIT Kharagpur
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
Tinyos-help at millennium.berkeley.edu<mailto:Tinyos-help at millennium.berkeley.edu>
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
--
With Best Regards
Himanshu Barve
IIT Kharagpur
No virus found in this incoming message.
Checked by AVG - www.avg.com<http://www.avg.com>
Version: 8.5.375 / Virus Database: 270.12.87/2195 - Release Date: 06/25/09 06:22:00
--
With Best Regards
Himanshu Barve
IIT Kharagpur
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.12.87/2195 - Release Date: 06/25/09 06:22:00
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090625/2f357cd4/attachment.htm
More information about the Tinyos-help
mailing list