Since I don't have T2 loaded, I'm going to go out on a limb
based only on conjecture here...
In T1 the TOS_Msg fields are
uint16_t addr;
uint8_t type;
uint8_t group;
uint8_t length;
int8_t data[TOSH_DATA_LENGTH];
with which I eyeball your battery data to be "22 01",
which when 'little-endianed' comes out to 0x0122 which
is 290 in real numbers. Since 2.9 is much closer to the
nominal 3v battery voltage, I'm going to guess that
VoltageC does the necessary conversion/calculation
for you. But you could probably just go look at the
code and see if it does anything other than shield
you from the ugly ADC interface it uses...
MS
Ali Mir wrote:
Hello friends
I wrote an application in tinyos-2.x to measure the battery voltage of a
mica2 mote. I read the data on the PC through the Listen application.
The data read from the mote was as follows. These are the consecutive
measurements taken.
00 FF FF 00 0B 02 22 01 67 40
00 FF FF 00 0B 02 22 01 67 40
00 FF FF 00 0B 02 22 01 67 80
00 FF FF 00 0B 02 22 01 67 40
00 FF FF 00 0B 02 22 01 67 80
00 FF FF 00 0B 02 22 01 67 80
00 FF FF 00 0B 02 22 01 67 80
00 FF FF 00 0B 02 22 01 67 80
I used the broadcast address to send data from the mote.The mote was
programmed using a mote ID 11. The data structure contains just
nx_uint16_t voltage as the voltage field.
typedef nx_struct Battery_Msg
{
nx_uint16_t voltage;
}battery_msg;
So,according to the message_t structure of tinyos-2.x the data field
must contain the bytes 02 22 ( Correct me if I am wrong ). Now
converting this data in decimal form and using the value in the formula
give by the CrossBow manual gives the battery voltage as 2.29 V which is
a valid voltage range for a mica2 mote.
Now i want to know if what i did was indeed correct or was by fluke. I
used the VoltageC component of tinyos-2.x to measure the voltage. Is
this the right thing to do? And if it is then is the value returned
by it the true voltage or the value to be used in the formula give in
the manual. I doubt my approach because somewhere in the mail archives i
read that the value returned is the true value and there isnt any need
to use the formula. I am not sure which one is the right thing. If
indeed this is true then the data what i measured is thoroughly wrong.
I dont know why I think that I have interpreted the message fields
incorrectly because I dont know the true size of am_addr_t , am_id_t and
am_group_t datatypes.
Please help me out
MMA
------------------------------------------------------------------------
_______________________________________________
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