Jennifer,

There are two main ways you can decode the packet.

1) At the mote by pulling out the data and pushing it to the serial port using printf, and the net.tinyos.tools.PrintfClient tool.

2) At the computer, decode the raw packet after receiving it using the SerialForwarder/net.tinyos.tools.Listen tool.

Each one has it's own advantages/disadvantages. It sounds like you are trying to do #1. If you using the BaseStation code as a base for you program, make sure you remove any code that forwards messages received over the air to the serial port.

In your receive event on the mote, all you have to do is add something like this:

printf("Counter Value: %u\n", cval);
printfflush();

Where cval is your desired uint16 value. It is important to flush the printf buffer frequently because it will not automatically start flushing the buffer until it is 1/2 - 2/3 full(which can make debugging difficult) . I normally manually flush the printf buffer every time I make a call to printf so I see the output immediately on the console.

-Paul


On 1/20/2010 3:56 PM, Jennifer Pink wrote:
Hi,
Hi,

In fact, i'm talking about the standard message buffer "message_t" .
you know that the values of the counter represent the data filed so,
my question is how to recover  this data and display it with printf ?

this is the structure of the message layout

typedef nx_struct test_serial_msg {
nx_uint16_t counter;
} test_serial_msg_t;


thanks in advance

Jennifer


From: [email protected]
Date: Wed, 20 Jan 2010 21:00:41 +0200
Subject: Re: [Tinyos-help] Can not display data in mote-PC serial communication
To: [email protected]
CC: [email protected]

Your explanation is a bit foggy.
Where exactly the problem is? After which step? What does work?.

Arik


On Wed, Jan 20, 2010 at 17:41, Jennifer Pink <[email protected] <mailto:[email protected]>> wrote:

    Hi all,

    I'm using tinyos-2.x on windows Xp.
    I tryed to follow the tutorial "mote-PC serial communication and
    serial forwarder"
    and every thing was ok.
    Now i want to display data from mote on my PC.
    when executed the TinyOS printf library in
    http://docs.tinyos.net/index.php/The_TinyOS_printf_Library
    it works very well but i can not integrate it in the "mote Pc
    serial communication" to display JUST the
    data that i sent.

    does any one know how to do that ?
    i need your help please.


    Regards,
    Jennifer



    ------------------------------------------------------------------------
    Avec Internet Explorer, surfez en toute discrétion sur internet
    Cliquez ici ! <http://clk.atdmt.com/FRM/go/182932252/direct/01/>

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




--
Best Regards,
Arik Sapojnik
[email protected] <mailto:[email protected]>

------------------------------------------------------------------------
Discute avec tes amis partout, grâce à Messenger sur ton mobile. Cliquez ici ! <http://www.messengersurvotremobile.com/>


_______________________________________________
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

Reply via email to