[Tinyos-help] Accessing whole word(16bits)

Paul Stickney pstickne at gmail.com
Thu Jun 12 07:34:55 PDT 2008


Use an nx_[u]int16_t field in your message structure.
You can define multiple message structures and overlay or use (but I
wouldn't recommend it) unions of structures.

Or explicitly "deconvert" in a compatible manner.
You *could* use a cast if endians align, but this is just bad behavior
to rely on.
Pay attention to the warning messages--the num * pointer is likely wrong.

HTH,
Paul

> From  Receiver I send RSSI value of packet received as follows to transmitter:
> gTxmsg ->data[0] = Msg->strength & 0xFF;
> gTxmsg ->data[1] = Msg->strength >>8;

> At transmitter I want to multiply it by some value say 5.How can I do it?
> x= 5 * Msg->data;
> is not yeilding correct results.
>
> Regards,
> Kishore
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>


More information about the Tinyos-help mailing list