Is it possible that the "jiffies" argument to configureSingleRepeat()
is an uint16? If so 65k is your max...
If you want to sample slower than that the regular TimerM sort of
loop may be a better option.
MS
Dmitry Medvedev wrote:
> Hi,
>
>
>
> I’m trying to use Msp430Adc12SingleChannel to continuously read data
> from ADC input. Assuming that SMCLK runs at 1 Mhz, the jiffies value of
> 1000000 in configureSingleRepeat should give me about 1Hz sampling
> frequency. But I notice that singleDataReady events are coming at a much
> faster rate. The test code is given below. Am I doing something wrong?
> How can I control the sampling frequency in the single channel repeat mode?
>
>
>
> Thanks in advance,
>
> Dmitry
>
>
>
>
>
> *****
>
>
>
> module AdcC {
>
> uses {
>
> interface Boot;
>
> interface Leds;
>
> interface Msp430Adc12SingleChannel as Adc;
>
> interface Resource;
>
> }
>
> }
>
>
>
> implementation {
>
>
>
> uint8_t count = 0;
>
>
>
> const msp430adc12_channel_config_t config = {
>
> inch: TEMPERATURE_DIODE_CHANNEL,
>
> sref: REFERENCE_AVcc_AVss,
>
> ref2_5v: REFVOLT_LEVEL_NONE,
>
> adc12ssel: SHT_SOURCE_SMCLK,
>
> adc12div: SHT_CLOCK_DIV_1,
>
> sht: SAMPLE_HOLD_4_CYCLES,
>
> sampcon_ssel: SAMPCON_SOURCE_SMCLK,
>
> sampcon_id: SAMPCON_CLOCK_DIV_1
>
> };
>
>
>
> event void Boot.booted() {
>
> call Resource.request();
>
> }
>
>
>
> event void Resource.granted() {
>
> if (call Adc.configureSingleRepeat(&config,1000000)==SUCCESS) {
>
> call Adc.getData();
>
> }
>
> }
>
>
>
> async event error_t Adc.singleDataReady(uint16_t data) {
>
> count++;
>
> call Leds.set(count);
>
> return SUCCESS;
>
> }
>
>
>
> async event uint16_t * Adc.multipleDataReady(uint16_t *buffer,
> uint16_t numSamples) {
>
> return buffer;
>
> }
>
>
>
> }
>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4284 (20090728) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.esetnod32.ru
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help