http://mspgcc.sourceforge.net/manual/x214.html
the msp430 alignment joy.

cheers,
maxime

Jose L. Ponce a écrit :

Hi,

I was able to solve the problem:

I noticed that there was something wrong with the uint16 field: I
programmed the mote to unpack the message and pack it in another one to
be sent back to the computer. If I sent 0x0a05 the return message would
be 0x0a00. I tried to divide the uint16 field in two uint8 fields (high
and low), and with that everything worked.

To cut a long story short, after a long hours of desperation, I did the
simplest thing I could think of. If my message structure was:

struct DimmerControlMSG
{
 uint8_t todo;
 uint16_t val;
};

I changed it for:

struct DimmerControlMSG
{
 uint16_t val;
 uint8_t todo;
};

And now everything's working!!

Any comments on this? Is this something which happens often?

-Jose.

On Tue, 2006-03-21 at 18:04 +0100, Jose L. Ponce wrote:
Hi all,

I want to control the DAC of my telosb mote using commands from the
computer through the USB port. For that, I've programmed an application
which receives a message with two fields: uint8_t for the command and
uint16_t for the value we want to set the DAC to.

There are two commands: set (1), with a value, to set the DAC, and show,
without a value, to see to which value the DAC is set to (when issuing a
set command, the mote returns the DAC value as well).

On the computer side, the commands are issued using a small java
application:

java Dimmer set X
java Dimmer show

The problem is that the value field (uint16_t) is not recognised: I will
issue java Dimmer set 10 ten times and each time I will get a different
DAC output and a different return value from the mote. I have tried to
modify my message type and have the value field as a uint8_t. In this
way, issuing a set command from 0 to 256 will give me right values.
Above that, it doesn't seem to work anymore.

Can anyone enlighten me a little on what I am doing wrong? It'd be much
appreciated.

Below I include the relevant code.

Thanks,

- Jose.

// DimmerControlM.nc (on the mote)
// DimmerControlMSG has two fields: todo (uint8_t) and value (uint16_t)

task void sendMsg(){
struct DimmerControlMSG* sen; sen = (struct DimmerControlMSG *)outw.data;
      sen->value = value;

      call SendMsg.send( TOS_UART_ADDR, sizeof(struct DimmerControlMSG), &outw);
 }

event TOS_MsgPtr ReceiveMsg.receive( TOS_MsgPtr inw ){
      struct DimmerControlMSG* rec;
      rec = (struct DimmerControlMSG *)inw->data;

      if( rec->todo & 0x1 ) {
         value=rec->value;
          if(call DAC.output(value) == SUCCESS)
             call Leds.redToggle();
      }

      post sendMsg();
      return inw;
 }


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



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

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

Reply via email to