[Tinyos-help] Msp430Adc12MultiChannel ADC conversion period problem
?
acorrd at hotmail.com
Fri Feb 13 23:26:57 PST 2009
Hi all,
I am working with Msp430Adc12MultiChannel interface.But it has problem about conversion period.
It has 5 sensors which is assigned to from A0 to A4. Conversion period for each channel is 100hz and all channels have same configuration.Thus a ADC into MSP430 will convert 500 per second.To check ADC conversion complete timing I have used oscilloscope and LED1 pin.From Below code , LED1 should toggle every 100ms. but it is toggling at 93.2ms not 100ms now.
Why is it incorrectly operate?Our project must integrate sensor value with time. Thus exact conversion period is important.
implementation{ const msp430adc12_channel_config_t config = { INPUT_CHANNEL_A0, REFERENCE_AVcc_AVss, REFVOLT_LEVEL_NONE, SHT_SOURCE_SMCLK, SHT_CLOCK_DIV_1, SAMPLE_HOLD_64_CYCLES, SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1 }; event void Boot.booted() { call Resource.request(); //from adc test } /////////////////////////////////////////////////// adc12memctl_t memctl[16]; uint8_t numMemctl; #define ADCNUMS 5 #define NUM_SAMPLES 50 uint16_t buffer[NUM_SAMPLES]; event void Resource.granted() { error_t result; uint8_t i; for(i=0; i<ADCNUMS-1; i++){ memctl[i].inch=i+1; //List of additional channels memctl[i].sref=REFERENCE_AVcc_AVss; } numMemctl = ADCNUMS - 1;//chs - 1 //1000000 MCLK / 500 sample per sec for all chs = 2000. result = call MultiChannel.configure(&config, memctl, numMemctl, buffer, NUM_SAMPLES, 2000); if (result == SUCCESS){ call MultiChannel.getData(); } else{ } }
//This must be called every 100ms. 10hz. //But now it is called 93.2ms every.!!! Why? async event void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples) {call Leds.led1Toggle(); //check by oscilloscope LED1 pin.
call MultiChannel.getData(); //call next conversion sequence... }
best regards,
K.S.Lee
_________________________________________________________________
간편하고 정확한 나만의 맞춤 검색, Live Search!
http://search.live.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090214/636ebed0/attachment-0001.htm
More information about the Tinyos-help
mailing list