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&nbsp;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&nbsp;</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>{ &nbsp;&nbsp;<=
/div><div>
&nbsp;&nbsp;</div><div>&nbsp;&nbsp; &nbsp;&nbsp;</div><div>&nbsp;&nbsp; con=
st msp430adc12_channel_config_t config =3D {</div><div>&nbsp;&nbsp; &nbsp;<=
/div><div>&nbsp;&nbsp; &nbsp;INPUT_CHANNEL_A0, REFERENCE_AVcc_AVss, REFVOLT=
_LEVEL_NONE,</div><div>&nbsp;&nbsp; &nbsp;SHT_SOURCE_SMCLK, SHT_CLOCK_DIV_1=
, SAMPLE_HOLD_64_CYCLES,</div>
<div>&nbsp;&nbsp; &nbsp;SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1&nbsp;</di=
v><div>&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp; };</div><div>&nbsp;&nbsp;=
</div><div>&nbsp;&nbsp;event void Boot.booted()</div><div>&nbsp;&nbsp;{</di=
v><div>&nbsp;&nbsp; &nbsp;call Resource.request();<span class=3D"Apple-tab-=
span" style=3D"white-space:pre">	</span>//from adc test</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp;}</div><div>&nbsp;&nb=
sp; &nbsp;///////////////////////////////////////////////////</div><div>&nb=
sp;&nbsp;adc12memctl_t memctl[16];</div><div>&nbsp;&nbsp;uint8_t numMemctl;=
</div><div>&nbsp;&nbsp;#define ADCNUMS 5<span class=3D"Apple-tab-span" styl=
e=3D"white-space:pre">	</span></div>
<div>&nbsp;&nbsp;#define NUM_SAMPLES 50</div><div>&nbsp;&nbsp;uint16_t buff=
er[NUM_SAMPLES];</div><div>&nbsp;&nbsp; &nbsp;&nbsp;</div><div>&nbsp;&nbsp;=
event void Resource.granted()</div><div>&nbsp;&nbsp;{</div><div>&nbsp;&nbsp=
; &nbsp;error_t result;</div><div>&nbsp;&nbsp; &nbsp;uint8_t i;</div><div>&=
nbsp;&nbsp; &nbsp;</div><div>
&nbsp;&nbsp; &nbsp;for(i=3D0; i&lt;ADCNUMS-1; i++){</div><div>&nbsp;&nbsp; =
&nbsp;<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>&nbsp;&nbsp; &nbsp;<span class=3D"Apple-tab-span" style=3D"white-space=
:pre">	</span>memctl[i].sref=3DREFERENCE_AVcc_AVss;</div><div>&nbsp;&nbsp; =
&nbsp;}</div><div>&nbsp;&nbsp; &nbsp;<span class=3D"Apple-tab-span" style=
=3D"white-space:pre">	</span></div><div>&nbsp;&nbsp; &nbsp;numMemctl =3D AD=
CNUMS - 1;//chs - 1</div>
<div>&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp;//1000000 MCLK / 500 =
sample per sec for all chs =3D 2000.&nbsp;</div><div>&nbsp;&nbsp; &nbsp;res=
ult =3D call MultiChannel.configure(&amp;config, memctl, numMemctl, buffer,=
 NUM_SAMPLES, 2000);</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp;</div><div>
&nbsp;&nbsp; &nbsp;if (result =3D=3D SUCCESS){</div><div>&nbsp;&nbsp; &nbsp=
; &nbsp;call MultiChannel.getData();</div><div>&nbsp;&nbsp; &nbsp;}</div><d=
iv>&nbsp;&nbsp; &nbsp;else{</div><div>&nbsp;&nbsp; &nbsp;<span class=3D"App=
le-tab-span" style=3D"white-space:pre">	</span></div><div>&nbsp;&nbsp; &nbs=
p;}</div><div>&nbsp;&nbsp; &nbsp;&nbsp;</div>
<div>&nbsp;&nbsp;}</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>&nbsp;&nbsp; &nbsp; &nbsp; //But now it is called 93.2ms every.!!=
! Why?</div><div>&nbsp;&nbsp;async event void MultiChannel.dataReady(uint16=
_t *buf, uint16_t numSamples)</div>
<div>&nbsp;&nbsp;{</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>&nbsp;&nbsp; &nbsp; &n=
bsp;</div><div>&nbsp;&nbsp;}</div>
</div><div><br></div>

--0016e64b076a064c9c0462db5187--


More information about the Tinyos-help mailing list