huh...in trying to answer another message-related question I looked at:
net/tinyos/message/Message.java
and found:
/**
* Read the 32 bit IEEE float at offset
* @param offset bit offset where the float starts
* @param length is ignored
* @exception ArrayIndexOutOfBoundsException for invalid offset
*/
protected float getFloatElement(int offset, int length)
throws ArrayIndexOutOfBoundsException {
return Float.intBitsToFloat((int)getUIntElement(offset, 32));
}
Which has what you want to roll your own float converter...
MS
Old Maven wrote:
I did a little bit of reading for floating point on my micaz platform. I
found out that the avr-gcc has lm (maths library) which could help
conduct floating point conversions within tinyos.
As for example, i could try floating point on the TOSSIM simulator as such.
y=sin(fmod(4,3.14159265));
dbg(DBG_ALL, "value of y is %10.4f\n", y);
this showed on correct results.
Now, i want to send this over the UART. But , the messages are sent in
8-bit HEX format ?
So, should i convert the FLOAT to HEX first into 4 8-bit chunks , and
assemble them on my JAVA to get a 32-bit float value ? or is, there any
other way, i can see the float on the UART ? Or, if there is a library
somewhere i could use for easy conversion.
Your input would be much appreciated.
Thanks
------------------------------------------------------------------------
_______________________________________________
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