No subject
Tue Jan 13 16:53:41 PST 2009
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...
}
--0016e64b076a064c9c0462db5187
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi all,<div><br></div><div>I am working with Msp430Adc12MultiChannel i=
nterface.</div><div>But it has problem about conversion period.</div><div><=
br></div><div>It has 5 sensors which is assigned to from A0 to A4. Conversi=
on period for each channel is </div>
<div>100hz and all channels have same configuration.</div><div>Thus a ADC i=
nto MSP430 will convert 500 per second.</div><div>To check ADC conversion c=
omplete timing I have used oscilloscope and LED1 pin.</div><div>From Below =
code , LED1 should toggle every 100ms. but it is toggling at 93.2ms not 100=
ms now.</div>
<div><br></div><div>Why is it incorrectly operate?</div><div>Our project mu=
st integrate sensor value with time. Thus exact conversion period is import=
ant.</div><div><br></div><div><div>implementation</div><div>{ <=
/div><div>
</div><div> </div><div> con=
st msp430adc12_channel_config_t config =3D {</div><div> <=
/div><div> INPUT_CHANNEL_A0, REFERENCE_AVcc_AVss, REFVOLT=
_LEVEL_NONE,</div><div> SHT_SOURCE_SMCLK, SHT_CLOCK_DIV_1=
, SAMPLE_HOLD_64_CYCLES,</div>
<div> SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1 </di=
v><div> </div><div> };</div><div> =
</div><div> event void Boot.booted()</div><div> {</di=
v><div> call Resource.request();<span class=3D"Apple-tab-=
span" style=3D"white-space:pre"> </span>//from adc test</div>
<div> </div><div> }</div><div> &nb=
sp; ///////////////////////////////////////////////////</div><div>&nb=
sp; adc12memctl_t memctl[16];</div><div> uint8_t numMemctl;=
</div><div> #define ADCNUMS 5<span class=3D"Apple-tab-span" styl=
e=3D"white-space:pre"> </span></div>
<div> #define NUM_SAMPLES 50</div><div> uint16_t buff=
er[NUM_SAMPLES];</div><div> </div><div> =
event void Resource.granted()</div><div> {</div><div>  =
; error_t result;</div><div> uint8_t i;</div><div>&=
nbsp; </div><div>
for(i=3D0; i<ADCNUMS-1; i++){</div><div> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>memc=
tl[i].inch=3Di+1;<span class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</span>//List of additional channels</div>
<div> <span class=3D"Apple-tab-span" style=3D"white-space=
:pre"> </span>memctl[i].sref=3DREFERENCE_AVcc_AVss;</div><div> =
}</div><div> <span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span></div><div> numMemctl =3D AD=
CNUMS - 1;//chs - 1</div>
<div> </div><div> //1000000 MCLK / 500 =
sample per sec for all chs =3D 2000. </div><div> res=
ult =3D call MultiChannel.configure(&config, memctl, numMemctl, buffer,=
NUM_SAMPLES, 2000);</div><div> &nb=
sp;</div><div>
if (result =3D=3D SUCCESS){</div><div>  =
; call MultiChannel.getData();</div><div> }</div><d=
iv> else{</div><div> <span class=3D"App=
le-tab-span" style=3D"white-space:pre"> </span></div><div> &nbs=
p;}</div><div> </div>
<div> }</div><div><br></div><div><span class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </span>//This must be called every 100ms. 10hz.<=
/div><div> //But now it is called 93.2ms every.!!=
! Why?</div><div> async event void MultiChannel.dataReady(uint16=
_t *buf, uint16_t numSamples)</div>
<div> {</div><div><span class=3D"Apple-tab-span" style=3D"white-=
space:pre"> </span>call Leds.led1Toggle();<span class=3D"Apple-tab-span" st=
yle=3D"white-space:pre"> </span>//check by oscilloscope LED1 pin.</div><di=
v><br></div><div>
<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>call Multi=
Channel.getData();<span class=3D"Apple-tab-span" style=3D"white-space:pre">=
</span>//call next conversion sequence...</div><div> &n=
bsp;</div><div> }</div>
</div><div><br></div>
--0016e64b076a064c9c0462db5187--
More information about the Tinyos-help
mailing list