Wasn't the value in msg->strenght some untransformed one? I remember having read that a function should be applied to it in order to obtain RSSI.
2007/6/29, Benjamin Madore <[EMAIL PROTECTED]>:
msg->strength is uint16_t You're only getting half the number. Besides, uint16_t * stren = (uint16_t *) msg->strength; RSSI = stren[0]; should be easier to read. I think there is an even more elegant way to state this, but I don't care enough to find it. Avoid doing multiple things on one line until your sure all your bugs are gone. (I.E. Never do multiple things on one line.) Let the compiler optimize. Your RSSI should be between 400 and 0. It is interpreted as a negative number, with 400 being quiet, and 0 being very loud. You can also wire to ADC.ADC[TOS_ADC_CC_RSSI_PORT] and call "ADC.getData();" which provides the event "ADC.dataReady(uint16_t data);" like you said. dataReady is singled every time anyone calls getData. The radio stack does this a lot. You have to filter out your calls. I might suggest a lock. When you call getData, set a boolean to true, and when you have read one value in dataReady, set it to false. -Ben On Fri, June 29, 2007 10:21 am, CASTEL Myriam said: > Hello, > > I'm trying to obtain the RSSI value with Mica2 motes. > -I programmed a component which stores the strength of a TOSMsg received: > RSSI=*((uint8_t *)recv_packet->strength); > But this doesn't give reasonnable results. I think this method is only > for the micaz? Isn't it? > > - In the documentation, I saw that the RSSI was given by the channel 0 > in mica2. > I tried to sample channel 0 with in configuration file: MyApp.ADC-> > ADCC.ADC[0]; > in module file: event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr > recv_packet){ > call ADC.getData(); > return recv_packet; > } > async event result_t ADC.dataReady(uint16_t data) { > atomic pack->xData.datap1.value = data; > post sendMsg(); > return SUCCESS; > } > but the problem is that the mote execute ADC.dataReady even if getData > wasn't called. Maybe I have forgotten some elements as: > call ADC.Control.bindPort(TOS_ADC_CC_RSSI_PORT,TOS_ACTUAL_CC_RSSI_PORT) > or other things. > > Can you help me to obtain RSSI value (with channel 0 or other)? If you > have the code to compute RSSI, can you send it to me? > > I'm sorry for this question but I'm new and I don't find the answers in > the documentation provided by Crossbow. > > Thanks > -- The difference between the right word and the almost right word is really a large matter- it's the difference between a lightning bug and the lightning. -Twain _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
-- "The truth shall set you free" <a href="http://www.nerdtests.com/nq_ref.html"> <img src="http://www.nerdtests.com/images/badge/dc875a1ab1aff18f.gif" alt="I am nerdier than 99% of all people. Are you a nerd? Click here to find out!"></a> _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help