No subject


Tue Jan 13 16:53:41 PST 2009


2ms not 100ms now.</p>
<p><br>Why is it incorrectly operate?<br>Our project must integrate sensor =
value with time. Thus exact conversion period is important.</p>
<p><br>implementation<br>{&nbsp;&nbsp; <br>&nbsp; <br>&nbsp;&nbsp;&nbsp;&nb=
sp; <br>&nbsp;&nbsp; const msp430adc12_channel_config_t config =3D {<br>&nb=
sp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; INPUT_CHANNEL_A0, REFERENCE_AVcc_AVs=
s, REFVOLT_LEVEL_NONE,<br>&nbsp;&nbsp;&nbsp; SHT_SOURCE_SMCLK, SHT_CLOCK_DI=
V_1, SAMPLE_HOLD_64_CYCLES,<br>
&nbsp;&nbsp;&nbsp; SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1 <br>&nbsp;&nbs=
p;&nbsp; <br>&nbsp;&nbsp; };<br>&nbsp; <br>&nbsp; event void Boot.booted()<=
br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; call Resource.request(); //from adc test<=
br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; }<br>&nbsp;&nbsp;&nbsp; //////=
/////////////////////////////////////////////<br>
&nbsp; adc12memctl_t memctl[16];<br>&nbsp; uint8_t numMemctl;<br>&nbsp; #de=
fine ADCNUMS 5 <br>&nbsp; #define NUM_SAMPLES 50<br>&nbsp; uint16_t buffer[=
NUM_SAMPLES];<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; event void Resource.gr=
anted()<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; error_t result;<br>&nbsp;&nbsp;&n=
bsp; uint8_t i;<br>
&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; for(i=3D0; i&lt;ADCNUMS-1; i++){<=
br>&nbsp;&nbsp;&nbsp;&nbsp; memctl[i].inch=3Di+1; //List of additional chan=
nels<br>&nbsp;&nbsp;&nbsp;&nbsp; memctl[i].sref=3DREFERENCE_AVcc_AVss;<br>&=
nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; numM=
emctl =3D ADCNUMS - 1;//chs - 1<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp=
; //1000000 MCLK / 500 sample per sec for all chs =3D 2000. <br>
&nbsp;&nbsp;&nbsp; result =3D call MultiChannel.configure(&amp;config, memc=
tl, numMemctl, buffer, NUM_SAMPLES, 2000);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; if (result =3D=
=3D SUCCESS){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call MultiChannel.getData()=
;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else{<br>&nbsp;&nbsp;&nbsp;=
&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; }</p>
<p><br>//This must be called every 100ms. 10hz.<br>&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; //But now it is called 93.2ms every.!!! Why?<br>&nbsp; async e=
vent void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples)<br>&nb=
sp; {<br>call Leds.led1Toggle(); //check by oscilloscope LED1 pin.</p>

<div><br>call MultiChannel.getData(); //call next conversion sequence...<br=
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; }</div>
<div>&nbsp;</div>
<div>best regards,</div>
<div>K.S.Lee</div>

--0016364582b4eda55f0462dbcff0--


More information about the Tinyos-help mailing list