Hi everybody,

I am trying to adquire data from the mma7260 accelerometer from the shimmer
platform. My code is this:

#include "printf.h"

module Accel2P{
    provides interface AdcConfigure<const msp430adc12_channel_config_t *> as
AdcConfigure;

    uses{
        interface Boot;
        interface Leds;
        interface Init as Mma7260Init;
        interface Mma7260;
        interface Timer<TMilli> as Timer;
        interface Read<uint16_t> as AdcRead;
    }
}

implementation{
    const msp430adc12_channel_config_t conf = {
        inch : INPUT_CHANNEL_A5,
        sref : REFERENCE_VREFplus_AVss,
        ref2_5v : REFVOLT_LEVEL_NONE,
        adc12ssel : SHT_SOURCE_SMCLK,
        adc12div : SHT_CLOCK_DIV_1,
        sht : SAMPLE_HOLD_4_CYCLES,
        sampcon_ssel : SAMPCON_SOURCE_ACLK,
        sampcon_id : SAMPCON_CLOCK_DIV_1,
    };

    event void Boot.booted(){
        call Timer.startPeriodic(512);
    }

    event void Timer.fired(){
        call Mma7260.setSensitivity(RANGE_1_5G);
        call Mma7260.wake(TRUE);
        call AdcRead.read();
    }

    event void AdcRead.readDone(error_t result, uint16_t val){
        printf("%u\n", val);
        printfflush();
        call Leds.led2Toggle();
    }

    async command const msp430adc12_channel_config_t*
AdcConfigure.getConfiguration(){
        return(&conf);
    }
}

I am trying to adquire data from the X-axis of the accelerometer (Channel
A5), but what is displayed is not any correct value. I don't know if I am
doing something bad...

Could somebody help me??

Thank you very much!

--
Jordi Casals
E-mail: [email protected]
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to