----- Forwarded Message ----
From: Philip Levis <[EMAIL PROTECTED]>
To: Thusitha Asela <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2007 9:28:36 PM
Subject: Re: Please Help Me to Continuously READ DATA FROM the EEPROM on a 
Micaz MOTE


Please send questions to tinyos-help.

Phil

On Mar 16, 2007, at 7:21 AM, Thusitha Asela wrote:

>
> Dear Sir,
>
>     I am a 4th Year Student at the University of Colombo School of  
> Computing Sri Lanka. I am doing a Sensor Application for my 4 th  
> Year Individual Project.
>
> So i tried to sample the Light Sensor data into EEPROM and then  
> read them continuously.
>
> I could verify that the data is written to the EEPROM correctly.
>
> According to the following Code:
>
>     I start Sense Light Reading.
>     Then call a Module to make a Request for confirmation to send  
> the Sampled         Data.
>     If Confirmation gets True:    It calls a task to READ from  
> EEPROM and Send                                                 Data
>                                                 Then In "SendDone()  
> " method, I again call  
> to                                                     READ FROM  
> EEPROM and Send the Data.
>                                                 I do this for 4 -8  
> Times.
>
> **  The Problem is that in each time it gives (BCAST) only the  
> First Data Packet.
>
> Is it relevant to some lack of refresh time??
>
> ** Please  help me to Continuously READ DATA FROM the EEPROM on  
> this Micaz MOTE.
> Or
> Can you please guide me to solve this Problem??
>
> Strongly appriciate your any commence!
>
>
> Followings are the Code. And i have Attached the full Code with  
> this as well.
>
> Please Give me some help!!!
>
> Thank You!
>
> Regards,
>
> Bandara.
>
> (The Happy is the Goal!)
>
>
>
>
> ______________________________________________________________
>
>
> //EEPROMReadM.nc
>
> includes MoteMsg;
>
> module BusEEPROMReadM
>
> {
>
> provides interface StdControl;
>
> provides interface ProcessRead;
>
> uses
>
> {
>
> interface StdControl as DataCommControl;
>
> interface StdControl as SounderControl;
>
> interface ControlSense as RepeatControlSense; //call command start 
> (int nsamples , int interval) and
>
> //implement event finish()
>
> interface Leds;
>
> interface SendMsg as DataSend;
>
> interface ReceiveMsg as DataReceive;
>
> interface LoggerRead;
>
> }
>
> }
>
> implementation
>
> {
>
> TOS_Msg data_msg;
>
> int no_of_packets_to_read;
>
> bool data_send_pending;
>
> bool eeprom_read_pending;
>
> task void readEEPROM()
>
> {
>
> result_t status = FAIL;
>
> call Leds.init();
>
> if(!eeprom_read_pending)
>
> {
>
> eeprom_read_pending = TRUE;
>
> if(call LoggerRead.readNext(((struct EEPROMMsg *)data_msg.data)- 
> >log)) //readNext(uint8_t *buffer);
>
> {
>
> call Leds.greenToggle();
>
>
> status = SUCCESS;
>
> }
>
> }
>
> signal ProcessRead.readEEPROMDone(status);
>
> }
>
> void readEEPROMRepeat()
>
> {
>
> call Leds.init();
>
> if(!eeprom_read_pending)
>
> {
>
> call SounderControl.start();
>
> eeprom_read_pending = TRUE;
>
> if(call LoggerRead.readNext(((struct EEPROMMsg *)data_msg.data)- 
> >log)) //readNext(uint8_t *buffer);
>
> {
>
> call Leds.greenToggle();
>
> eeprom_read_pending = TRUE;
>
>
> }
>
> }
>
> }
>
> command result_t StdControl.init()
>
> {
>
> no_of_packets_to_read = 0;
>
> data_send_pending = FALSE;
>
> eeprom_read_pending = FALSE;
>
> call SounderControl.init();
>
> return rcombine(call DataCommControl.init() , call Leds.init());
>
> }
>
> command result_t StdControl.start()
>
> {
>
> return SUCCESS;
>
> }
>
> command result_t StdControl.stop()
>
> {
>
> return SUCCESS;
>
> }
>
> result_t checkRepeat(uint8_t num)
>
> {
>
> call Leds.init();
>
> if(num>0)
>
> {
>
> call Leds.yellowToggle();
>
> readEEPROMRepeat();
>
>
> }
>
> else
>
> {
>
> call RepeatControlSense.start(32 , 500);
>
> }
>
> return SUCCESS;
>
> }
>
>
> command result_t ProcessRead.readEEPROM(uint8_t num)
>
> {
>
> no_of_packets_to_read = num;
>
>
> post readEEPROM();
>
> return SUCCESS;
>
> }
>
> event TOS_MsgPtr DataReceive.receive(TOS_MsgPtr pmsg)
>
> {
>
> return pmsg;
>
> }
>
> event result_t LoggerRead.readDone(uint8_t *buffer , result_t status)
>
> {
>
> struct EEPROMMsg *pack;
>
>
> call Leds.redToggle();
>
> if(status && eeprom_read_pending && !data_send_pending)
>
> {
>
> call Leds.yellowToggle();
>
> data_send_pending = TRUE;
>
> pack = (struct EEPROMMsg *)data_msg.data;
>
> atomic{
>
> pack->sourceMoteID = TOS_LOCAL_ADDRESS;
>
> }
>
> if(call DataSend.send(TOS_BCAST_ADDR , sizeof(struct  
> EEPROMMsg ) ,&data_msg ))
>
> {
>
> call Leds.greenToggle();
>
> no_of_packets_to_read--;
>
> call Leds.redOn();
>
> }
>
> }
>
> eeprom_read_pending = FALSE;
>
> return SUCCESS;
>
> }
>
>
>
> event result_t DataSend.sendDone(TOS_MsgPtr pmsg , result_t status)
>
> {
>
>
> eeprom_read_pending = FALSE;
>
> data_send_pending = FALSE;
>
> checkRepeat(no_of_packets_to_read);
>
>
> return SUCCESS;
>
> }
>
>
> event result_t RepeatControlSense.finish()
>
> {
>
> return SUCCESS;
>
> }
>
> default event result_t ProcessRead.readEEPROMDone(result_t status)
>
> {
>
> result_t test=FAIL;
>
>
> checkRepeat(no_of_packets_to_read);
>
> return SUCCESS;
>
> }
>
> }
>
> ______________________________________________________________________ 
> _____________________
>
>
>
> Expecting? Get great news right away with email Auto-Check.
> Try the Yahoo! Mail Beta.
> <BusNetMote2_25_1.0.zip>


 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to