Hi,

I didn't try it on TOSSIM. But it should work in Motes.

Regards,
Bandara.


----- Original Message ----
From: Dasarath Weeratunge <[EMAIL PROTECTED]>
To: Thusitha Asela <[EMAIL PROTECTED]>
Sent: Friday, March 23, 2007 1:58:30 AM
Subject: Re: [Tinyos-help] Please Help Me to Continuously READ DATA FROM the 
EEPROM on a Micaz MOTE


Quoting Thusitha Asela <[EMAIL PROTECTED]>:

Does your code work on TOSSIM?

--dasarath

> 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;
> }
> }
> 
________________________________________________________________________________
___________
> 
> 
>  
> 
________________________________________________________________________________
____
> Now that's room service!  Choose from over 150,000 hotels
> in 45,000 destinations on Yahoo! Travel to find your fit.
> http://farechase.yahoo.com/promo-generic-14795097


 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to