Re: [Tinyos-help] Problem ADC with MSP430 in tinyos 2.1

2011-09-27 Thread Juan Verdu
Hello everybody,

Thank you very much for the help everyone, the error was not called
Control.start.

My apologies for the translation.

A greeting

El 27 de septiembre de 2011 20:46, Antonio Linan escribió:

> Jan is right, no calls to Control.start() are made, also you should do
> something like:
>
>
> event void Control.startDone(error_t err) {
>   if (error == SUCCESS){
> // continue
>   } else {
> call Control.start();
> }
>
> To ensure is running, you can also consider to use leds to ease the
> debugging process.
>
> Good luck :)
>
> Antonio.
>
> On Tue, Sep 27, 2011 at 8:06 PM, Jan Hauer  wrote:
>
>> It looks like you forget to call SplitControl.start() (provided by
>> ActiveMessageC or SerialActiveMessageC) ...
>>
>> Jan
>>
>> On Tue, Sep 27, 2011 at 7:10 PM, Juan Verdu  wrote:
>> > Hello everyone,
>> >
>> > I am working with a MSP430F2617 microcontroller  and a radio CC2420
>> under
>> > the Zolertia driver.
>> >
>> > I am making an application to read the internal temperature of the
>> > microcontroller, and later I will send the information to a base station
>> > under the Basestation application.
>> >
>> > My application performs Send () correctly but this application fails
>> > AM.sendDone (), if I change the component SerialActiveMessageC by
>> > ActiveMessageC, the same problem will happen. In this case, I do not use
>> a
>> > radio. I use the serial port and I wouldn´t use the BaseStation
>> application.
>> >
>> > The code is as follows:
>> >
>> >
>> > Makefile
>> >
>> > COMPONENT=TestAdcAppC
>> > CFLAGS += -DADC12_TIMERA_ENABLED
>> > CFLAGS += -DADC12_ONLY_WITH_DMA
>> > include $(MAKERULES)
>> > CFLAGS += -DCC2420_DEF_CHANNEL=20
>> >
>> > TestAdc.h
>> >
>> >
>> > #ifndef TEST_SERIAL_H
>> > #define TEST_SERIAL_H
>> > typedef nx_struct test_serial_msg {
>> >   nx_uint16_t counter;
>> > } test_serial_msg_t;
>> > enum {
>> >   AM_TEST_SERIAL_MSG = 0x89,
>> > };
>> > #endif
>> >
>> > TestAdcC.nc
>> >
>> > #include "Timer.h"
>> > #include "TestAdc.h"
>> >
>> > module TestAdcC
>> > {
>> >   uses interface Boot;
>> >   uses interface Leds;
>> >   uses interface Timer as Timer0;
>> > uses interface Msp430Adc12Overflow as overflow;
>> >   uses interface Msp430Adc12SingleChannel as adc;
>> >   uses interface Resource;
>> >   uses interface SplitControl as Control;
>> >   uses interface Packet;
>> >   uses interface AMSend;
>> > }
>> >
>> > implementation
>> > {
>> > #define BUF_SIZE 100
>> >   uint16_t buf[BUF_SIZE];
>> >  message_t packet;
>> >
>> > uint16_t counter = 0;
>> > uint16_t Data;
>> >
>> > void configureSingle();
>> > msp430adc12_channel_config_t adcconfig = {
>> > inch: SUPPLY_VOLTAGE_HALF_CHANNEL,
>> > sref: REFERENCE_VREFplus_AVss,
>> > ref2_5v: REFVOLT_LEVEL_1_5,
>> > adc12ssel: SHT_SOURCE_ACLK,
>> > 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();
>> >}
>> > async event void overflow.conversionTimeOverflow(){
>> >}
>> >   async event void overflow.memOverflow(){
>> >   }
>> >
>> >   async event uint16_t *adc.multipleDataReady(uint16_t *buffer, uint16_t
>> > numSamples){
>> > return buffer;
>> >   }
>> >  task void send(){
>> > test_serial_msg_t* rcm = (test_serial_msg_t*)call
>> > Packet.getPayload(&packet, sizeof(test_serial_msg_t));
>> > // call Resource.release();
>> > call Leds.led0Toggle();
>> >  rcm->counter = Data;
>> > if(  call AMSend.send(AM_BROADCAST_ADDR, &packet,
>> > sizeof(test_serial_msg_t)) == SUCCESS)
>> > call Leds.led1Toggle();
>> > }
>> >   async event error_t adc.singleDataReady(uint16_t data){
>> > Data = data;
>> > post send();
>> >   return SUCCESS;
>> >   }
>> > event void Resource.granted(){
>> > configureSingle();
>> > call Timer0.startPeriodic(2048);
>> >   }
>> >   void configureSingle(){
>> > error_t e;
>> > e = call adc.configureSingle(&adcconfig);
>> >   }
>> > event void Timer0.fired()
>> >   {
>> > call adc.getData();
>> >   }
>> > event void AMSend.sendDone(message_t* bufPtr, error_t error) {
>> > call Leds.led2Toggle();
>> > }
>> > event void Control.startDone(error_t err) {
>> >   }
>> >
>> >  event void Control.stopDone(error_t err) {
>> > }
>> > }
>> >
>> > TestAdcAppC.nc
>> >
>> > #include "TestAdc.h"
>> > configuration TestAdcAppC {
>> > }
>> > implementation
>> > {
>> >   components MainC,
>> >  TestAdcC,
>> >  LedsC;
>> >  components ActiveMessageC as AM;
>> >  components new TimerMilliC() as Timer0;
>> >  components new Msp430Adc12ClientAutoDMAC() as Lectura;
>> >   TestAdcC.overflow -> Lectura;
>> >   TestAdcC.adc -> Lectura;
>> >   TestAdcC.Resource -> Lectura;
>> >TestAdcC -> MainC.Boot;
>> >   TestAdcC.Leds -> LedsC;
>> >   TestAdcC.Timer0 -> Timer0;
>> >   TestAdcC.Control -> AM;

Re: [Tinyos-help] Problem ADC with MSP430 in tinyos 2.1

2011-09-27 Thread Antonio Linan
Jan is right, no calls to Control.start() are made, also you should do
something like:

event void Control.startDone(error_t err) {
  if (error == SUCCESS){
// continue
  } else {
call Control.start();
}

To ensure is running, you can also consider to use leds to ease the
debugging process.

Good luck :)

Antonio.

On Tue, Sep 27, 2011 at 8:06 PM, Jan Hauer  wrote:

> It looks like you forget to call SplitControl.start() (provided by
> ActiveMessageC or SerialActiveMessageC) ...
>
> Jan
>
> On Tue, Sep 27, 2011 at 7:10 PM, Juan Verdu  wrote:
> > Hello everyone,
> >
> > I am working with a MSP430F2617 microcontroller  and a radio CC2420 under
> > the Zolertia driver.
> >
> > I am making an application to read the internal temperature of the
> > microcontroller, and later I will send the information to a base station
> > under the Basestation application.
> >
> > My application performs Send () correctly but this application fails
> > AM.sendDone (), if I change the component SerialActiveMessageC by
> > ActiveMessageC, the same problem will happen. In this case, I do not use
> a
> > radio. I use the serial port and I wouldn´t use the BaseStation
> application.
> >
> > The code is as follows:
> >
> >
> > Makefile
> >
> > COMPONENT=TestAdcAppC
> > CFLAGS += -DADC12_TIMERA_ENABLED
> > CFLAGS += -DADC12_ONLY_WITH_DMA
> > include $(MAKERULES)
> > CFLAGS += -DCC2420_DEF_CHANNEL=20
> >
> > TestAdc.h
> >
> >
> > #ifndef TEST_SERIAL_H
> > #define TEST_SERIAL_H
> > typedef nx_struct test_serial_msg {
> >   nx_uint16_t counter;
> > } test_serial_msg_t;
> > enum {
> >   AM_TEST_SERIAL_MSG = 0x89,
> > };
> > #endif
> >
> > TestAdcC.nc
> >
> > #include "Timer.h"
> > #include "TestAdc.h"
> >
> > module TestAdcC
> > {
> >   uses interface Boot;
> >   uses interface Leds;
> >   uses interface Timer as Timer0;
> > uses interface Msp430Adc12Overflow as overflow;
> >   uses interface Msp430Adc12SingleChannel as adc;
> >   uses interface Resource;
> >   uses interface SplitControl as Control;
> >   uses interface Packet;
> >   uses interface AMSend;
> > }
> >
> > implementation
> > {
> > #define BUF_SIZE 100
> >   uint16_t buf[BUF_SIZE];
> >  message_t packet;
> >
> > uint16_t counter = 0;
> > uint16_t Data;
> >
> > void configureSingle();
> > msp430adc12_channel_config_t adcconfig = {
> > inch: SUPPLY_VOLTAGE_HALF_CHANNEL,
> > sref: REFERENCE_VREFplus_AVss,
> > ref2_5v: REFVOLT_LEVEL_1_5,
> > adc12ssel: SHT_SOURCE_ACLK,
> > 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();
> >}
> > async event void overflow.conversionTimeOverflow(){
> >}
> >   async event void overflow.memOverflow(){
> >   }
> >
> >   async event uint16_t *adc.multipleDataReady(uint16_t *buffer, uint16_t
> > numSamples){
> > return buffer;
> >   }
> >  task void send(){
> > test_serial_msg_t* rcm = (test_serial_msg_t*)call
> > Packet.getPayload(&packet, sizeof(test_serial_msg_t));
> > // call Resource.release();
> > call Leds.led0Toggle();
> >  rcm->counter = Data;
> > if(  call AMSend.send(AM_BROADCAST_ADDR, &packet,
> > sizeof(test_serial_msg_t)) == SUCCESS)
> > call Leds.led1Toggle();
> > }
> >   async event error_t adc.singleDataReady(uint16_t data){
> > Data = data;
> > post send();
> >   return SUCCESS;
> >   }
> > event void Resource.granted(){
> > configureSingle();
> > call Timer0.startPeriodic(2048);
> >   }
> >   void configureSingle(){
> > error_t e;
> > e = call adc.configureSingle(&adcconfig);
> >   }
> > event void Timer0.fired()
> >   {
> > call adc.getData();
> >   }
> > event void AMSend.sendDone(message_t* bufPtr, error_t error) {
> > call Leds.led2Toggle();
> > }
> > event void Control.startDone(error_t err) {
> >   }
> >
> >  event void Control.stopDone(error_t err) {
> > }
> > }
> >
> > TestAdcAppC.nc
> >
> > #include "TestAdc.h"
> > configuration TestAdcAppC {
> > }
> > implementation
> > {
> >   components MainC,
> >  TestAdcC,
> >  LedsC;
> >  components ActiveMessageC as AM;
> >  components new TimerMilliC() as Timer0;
> >  components new Msp430Adc12ClientAutoDMAC() as Lectura;
> >   TestAdcC.overflow -> Lectura;
> >   TestAdcC.adc -> Lectura;
> >   TestAdcC.Resource -> Lectura;
> >TestAdcC -> MainC.Boot;
> >   TestAdcC.Leds -> LedsC;
> >   TestAdcC.Timer0 -> Timer0;
> >   TestAdcC.Control -> AM;
> >   TestAdcC.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
> >   TestAdcC.Packet -> AM;
> > }
> >
> > Could someone help me?
> >
> > Escribe texto o la dirección de un sitio web, o bien, traduce un
> documento.
> > Cancelar
> >
> > traducción del español al inglés
> >
> > A greeting and thank you very much
> >
> > ___
> > Tinyos-help mailing list
> > Tinyos

Re: [Tinyos-help] Problem ADC with MSP430 in tinyos 2.1

2011-09-27 Thread Jan Hauer
It looks like you forget to call SplitControl.start() (provided by
ActiveMessageC or SerialActiveMessageC) ...

Jan

On Tue, Sep 27, 2011 at 7:10 PM, Juan Verdu  wrote:
> Hello everyone,
>
> I am working with a MSP430F2617 microcontroller  and a radio CC2420 under
> the Zolertia driver.
>
> I am making an application to read the internal temperature of the
> microcontroller, and later I will send the information to a base station
> under the Basestation application.
>
> My application performs Send () correctly but this application fails
> AM.sendDone (), if I change the component SerialActiveMessageC by
> ActiveMessageC, the same problem will happen. In this case, I do not use a
> radio. I use the serial port and I wouldn´t use the BaseStation application.
>
> The code is as follows:
>
>
> Makefile
>
> COMPONENT=TestAdcAppC
> CFLAGS += -DADC12_TIMERA_ENABLED
> CFLAGS += -DADC12_ONLY_WITH_DMA
> include $(MAKERULES)
> CFLAGS += -DCC2420_DEF_CHANNEL=20
>
> TestAdc.h
>
>
> #ifndef TEST_SERIAL_H
> #define TEST_SERIAL_H
> typedef nx_struct test_serial_msg {
>   nx_uint16_t counter;
> } test_serial_msg_t;
> enum {
>   AM_TEST_SERIAL_MSG = 0x89,
> };
> #endif
>
> TestAdcC.nc
>
> #include "Timer.h"
> #include "TestAdc.h"
>
> module TestAdcC
> {
>   uses interface Boot;
>   uses interface Leds;
>   uses interface Timer as Timer0;
>     uses interface Msp430Adc12Overflow as overflow;
>   uses interface Msp430Adc12SingleChannel as adc;
>   uses interface Resource;
>   uses interface SplitControl as Control;
>   uses interface Packet;
>   uses interface AMSend;
> }
>
> implementation
> {
> #define BUF_SIZE 100
>   uint16_t buf[BUF_SIZE];
>  message_t packet;
>
> uint16_t counter = 0;
> uint16_t Data;
>
> void configureSingle();
> msp430adc12_channel_config_t adcconfig = {
>     inch: SUPPLY_VOLTAGE_HALF_CHANNEL,
>     sref: REFERENCE_VREFplus_AVss,
>     ref2_5v: REFVOLT_LEVEL_1_5,
>     adc12ssel: SHT_SOURCE_ACLK,
>     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();
>    }
> async event void overflow.conversionTimeOverflow(){
>    }
>   async event void overflow.memOverflow(){
>       }
>
>   async event uint16_t *adc.multipleDataReady(uint16_t *buffer, uint16_t
> numSamples){
>             return buffer;
>   }
>  task void send(){
>     test_serial_msg_t* rcm = (test_serial_msg_t*)call
> Packet.getPayload(&packet, sizeof(test_serial_msg_t));
>     // call Resource.release();
>     call Leds.led0Toggle();
>      rcm->counter = Data;
>     if(  call AMSend.send(AM_BROADCAST_ADDR, &packet,
> sizeof(test_serial_msg_t)) == SUCCESS)
>         call Leds.led1Toggle();
>     }
>   async event error_t adc.singleDataReady(uint16_t data){
>     Data = data;
>     post send();
>   return SUCCESS;
>   }
>     event void Resource.granted(){
>     configureSingle();
>     call Timer0.startPeriodic(2048);
>   }
>   void configureSingle(){
>     error_t e;
>     e = call adc.configureSingle(&adcconfig);
>   }
> event void Timer0.fired()
>   {
>     call adc.getData();
>   }
> event void AMSend.sendDone(message_t* bufPtr, error_t error) {
>     call Leds.led2Toggle();
> }
> event void Control.startDone(error_t err) {
>       }
>
>  event void Control.stopDone(error_t err) {
>     }
> }
>
> TestAdcAppC.nc
>
> #include "TestAdc.h"
> configuration TestAdcAppC {
> }
> implementation
> {
>   components MainC,
>  TestAdcC,
>  LedsC;
>  components ActiveMessageC as AM;
>  components new TimerMilliC() as Timer0;
>  components new Msp430Adc12ClientAutoDMAC() as Lectura;
>   TestAdcC.overflow -> Lectura;
>   TestAdcC.adc -> Lectura;
>   TestAdcC.Resource -> Lectura;
>    TestAdcC -> MainC.Boot;
>   TestAdcC.Leds -> LedsC;
>   TestAdcC.Timer0 -> Timer0;
>   TestAdcC.Control -> AM;
>   TestAdcC.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
>   TestAdcC.Packet -> AM;
> }
>
> Could someone help me?
>
> Escribe texto o la dirección de un sitio web, o bien, traduce un documento.
> Cancelar
>
> traducción del español al inglés
>
> A greeting and thank you very much
>
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>

___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Problem ADC with MSP430 in tinyos 2.1

2011-09-27 Thread Michael Schippling
There may be an overloading of "AMSend" names going on...

In the congig file try, instead of
 TestAdcC.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
something like:
 TestAdcC.TestMessage -> AM.AMSend[AM_TEST_SERIAL_MSG];

And then in the program file use:
 call TestMessage.send(AM_BROADCAST_ADDR, ...
and
 event void TestMessage.sendDone(message_t* ...

That's how I would do it with the old and moldy TOS1.x code anyway.
MS

Juan Verdu wrote:
> Hello everyone,
> 
> I am working with a MSP430F2617 microcontroller  and a radio CC2420 
> under the Zolertia driver.
> 
> I am making an application to read the internal temperature of the 
> microcontroller, and later I will send the information to a base station 
> under the Basestation application.
> 
> My application performs Send () correctly but this application fails 
> AM.sendDone (), if I change the component SerialActiveMessageC by 
> ActiveMessageC, the same problem will happen. In this case, I do not use 
> a radio. I use the serial port and I wouldn´t use the BaseStation 
> application.
> 
> The code is as follows:
> 
> 
> _Makefile_
> 
> COMPONENT=TestAdcAppC
> CFLAGS += -DADC12_TIMERA_ENABLED
> CFLAGS += -DADC12_ONLY_WITH_DMA
> include $(MAKERULES)
> CFLAGS += -DCC2420_DEF_CHANNEL=20
> 
> _TestAdc.h_
> 
> 
> #ifndef TEST_SERIAL_H
> #define TEST_SERIAL_H
> typedef nx_struct test_serial_msg {
>   nx_uint16_t counter;
> } test_serial_msg_t;
> enum {
>   AM_TEST_SERIAL_MSG = 0x89,
> };
> #endif
> 
> _TestAdcC.nc _
> 
> #include "Timer.h"
> #include "TestAdc.h"
> 
> module TestAdcC
> {
>   uses interface Boot;
>   uses interface Leds;
>   uses interface Timer as Timer0;
> uses interface Msp430Adc12Overflow as overflow;
>   uses interface Msp430Adc12SingleChannel as adc;
>   uses interface Resource;
>   uses interface SplitControl as Control;
>   uses interface Packet;
>   uses interface AMSend;
> }
> 
> implementation
> {
> #define BUF_SIZE 100
>   uint16_t buf[BUF_SIZE];
>  message_t packet;
> 
> uint16_t counter = 0;
> uint16_t Data;
> 
> void configureSingle();
> msp430adc12_channel_config_t adcconfig = {
> inch: SUPPLY_VOLTAGE_HALF_CHANNEL,
> sref: REFERENCE_VREFplus_AVss,
> ref2_5v: REFVOLT_LEVEL_1_5,
> adc12ssel: SHT_SOURCE_ACLK,
> 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();
>}
> async event void overflow.conversionTimeOverflow(){
>}
>   async event void overflow.memOverflow(){
>   }
>  
>   async event uint16_t *adc.multipleDataReady(uint16_t *buffer, uint16_t 
> numSamples){
> return buffer;
>   }
>  task void send(){
> test_serial_msg_t* rcm = (test_serial_msg_t*)call 
> Packet.getPayload(&packet, sizeof(test_serial_msg_t));
> // call Resource.release();
> call Leds.led0Toggle();
>  rcm->counter = Data;
> if(  call AMSend.send(AM_BROADCAST_ADDR, &packet, 
> sizeof(test_serial_msg_t)) == SUCCESS)
> call Leds.led1Toggle();
> }
>   async event error_t adc.singleDataReady(uint16_t data){
> Data = data;
> post send();
>   return SUCCESS;
>   }  
> event void Resource.granted(){
> configureSingle();
> call Timer0.startPeriodic(2048);
>   }
>   void configureSingle(){
> error_t e;
> e = call adc.configureSingle(&adcconfig);
>   }
> event void Timer0.fired()
>   {
> call adc.getData();
>   }
> event void AMSend.sendDone(message_t* bufPtr, error_t error) {
> call Leds.led2Toggle();
> }
> event void Control.startDone(error_t err) {
>   }
> 
>  event void Control.stopDone(error_t err) {
> }
> }
> 
> _TestAdcAppC.nc_
> 
> #include "TestAdc.h"
> configuration TestAdcAppC {
> }
> implementation
> {
>   components MainC,
>  TestAdcC,
>  LedsC;
>  components ActiveMessageC as AM;
>  components new TimerMilliC() as Timer0;
>  components new Msp430Adc12ClientAutoDMAC() as Lectura;
>   TestAdcC.overflow -> Lectura;
>   TestAdcC.adc -> Lectura;
>   TestAdcC.Resource -> Lectura;
>TestAdcC -> MainC.Boot;
>   TestAdcC.Leds -> LedsC;
>   TestAdcC.Timer0 -> Timer0;
>   TestAdcC.Control -> AM;
>   TestAdcC.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
>   TestAdcC.Packet -> AM;
> }
> 
> Could someone help me?
> 
> Escribe texto o la dirección de un sitio web, o bien, traduce un 
> documento .
> Cancelar 
> 
> 
>   traducción del español al inglés
> 
> A greeting and thank you very much
> 
> 
> 
> 
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
___
Tinyos-help mailing list
Tinyos-help@millennium.berk

[Tinyos-help] Problem ADC with MSP430 in tinyos 2.1

2011-09-27 Thread Juan Verdu
Hello everyone,

I am working with a MSP430F2617 microcontroller  and a radio CC2420 underthe
Zolertia driver.

I am making an application to read the internal temperature of the
microcontroller, and later I will send the information to a base station under
the Basestation application.

My application performs Send () correctly but this application fails
AM.sendDone (), if I change the component SerialActiveMessageC by
ActiveMessageC, the same problem will happen. In this case, I do not use a
radio. I use the serial port and I wouldn´t use the BaseStation application.

The code is as follows:


*Makefile*

COMPONENT=TestAdcAppC
CFLAGS += -DADC12_TIMERA_ENABLED
CFLAGS += -DADC12_ONLY_WITH_DMA
include $(MAKERULES)
CFLAGS += -DCC2420_DEF_CHANNEL=20

*TestAdc.h*


#ifndef TEST_SERIAL_H
#define TEST_SERIAL_H
typedef nx_struct test_serial_msg {
  nx_uint16_t counter;
} test_serial_msg_t;
enum {
  AM_TEST_SERIAL_MSG = 0x89,
};
#endif

*TestAdcC.nc *

#include "Timer.h"
#include "TestAdc.h"

module TestAdcC
{
  uses interface Boot;
  uses interface Leds;
  uses interface Timer as Timer0;
uses interface Msp430Adc12Overflow as overflow;
  uses interface Msp430Adc12SingleChannel as adc;
  uses interface Resource;
  uses interface SplitControl as Control;
  uses interface Packet;
  uses interface AMSend;
}

implementation
{
#define BUF_SIZE 100
  uint16_t buf[BUF_SIZE];
 message_t packet;

uint16_t counter = 0;
uint16_t Data;

void configureSingle();
msp430adc12_channel_config_t adcconfig = {
inch: SUPPLY_VOLTAGE_HALF_CHANNEL,
sref: REFERENCE_VREFplus_AVss,
ref2_5v: REFVOLT_LEVEL_1_5,
adc12ssel: SHT_SOURCE_ACLK,
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();
   }
async event void overflow.conversionTimeOverflow(){
   }
  async event void overflow.memOverflow(){
  }

  async event uint16_t *adc.multipleDataReady(uint16_t *buffer, uint16_t
numSamples){
return buffer;
  }
 task void send(){
test_serial_msg_t* rcm = (test_serial_msg_t*)call
Packet.getPayload(&packet, sizeof(test_serial_msg_t));
// call Resource.release();
call Leds.led0Toggle();
 rcm->counter = Data;
if(  call AMSend.send(AM_BROADCAST_ADDR, &packet,
sizeof(test_serial_msg_t)) == SUCCESS)
call Leds.led1Toggle();
}
  async event error_t adc.singleDataReady(uint16_t data){
Data = data;
post send();
  return SUCCESS;
  }
event void Resource.granted(){
configureSingle();
call Timer0.startPeriodic(2048);
  }
  void configureSingle(){
error_t e;
e = call adc.configureSingle(&adcconfig);
  }
event void Timer0.fired()
  {
call adc.getData();
  }
event void AMSend.sendDone(message_t* bufPtr, error_t error) {
call Leds.led2Toggle();
}
event void Control.startDone(error_t err) {
  }

 event void Control.stopDone(error_t err) {
}
}

*TestAdcAppC.nc*

#include "TestAdc.h"
configuration TestAdcAppC {
}
implementation
{
  components MainC,
 TestAdcC,
 LedsC;
 components ActiveMessageC as AM;
 components new TimerMilliC() as Timer0;
 components new Msp430Adc12ClientAutoDMAC() as Lectura;
  TestAdcC.overflow -> Lectura;
  TestAdcC.adc -> Lectura;
  TestAdcC.Resource -> Lectura;
   TestAdcC -> MainC.Boot;
  TestAdcC.Leds -> LedsC;
  TestAdcC.Timer0 -> Timer0;
  TestAdcC.Control -> AM;
  TestAdcC.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
  TestAdcC.Packet -> AM;
}

Could someone help me?

Escribe texto o la dirección de un sitio web, o bien, traduce un
documento
.
Cancelar 
traducción del español al inglés
A greeting and thank you very much
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help