Thanks for the help. The TSR is Total Solar Radiation (TSR) sensor. I am new
to TinyOS what goes into version, interval, id, count and reading. Also how
to wire OscilloscopeC.Read to the sensor (I guess I need to wire it to
HamamatsuC.TSR). Do I need to write new file for wiring? I am using Tmote
Sky.

Thanks,

SAIF

-----Original Message-----
From: Peizhao Hu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 07, 2007 9:18 PM
To: Saif A. Al-Hiddabi
Cc: 'Tinyos-Help'
Subject: Re: [Tinyos-help] TSR reading in Oscilloscope application

To achieve what you want to do in TinyOS. You just need to modify the 
following for single reading per packet.

// Oscilloscope.h

typedef nx_struct oscilloscope {
   nx_uint16_t version; /* Version of the interval. */
   nx_uint16_t interval; /* Samping period. */
   nx_uint16_t id; /* Mote id of sending mote. */
   nx_uint16_t count; /* The readings are samples count * NREADINGS 
onwards */
   nx_uint16_t reading;
} oscilloscope_t;


// OscilloscopeC.nc

event void Timer.fired() {
        if (!sendbusy && sizeof local <= call AMSend.maxPayloadLength())
          {
            memcpy(call AMSend.getPayload(&sendbuf), &local, sizeof local);
            if (call AMSend.send(AM_BROADCAST_ADDR, &sendbuf, sizeof local)
== 
SUCCESS)
              sendbusy = TRUE;
          }
        if (!sendbusy)
          report_problem();

        /* Part 2 of cheap "time sync": increment our count if we didn't
           jump ahead. */
        if (!suppress_count_change)
          local.count++;
        suppress_count_change = FALSE;

     if (call Read.read() != SUCCESS)
       report_problem();
   }



  event void Read.readDone(error_t result, uint16_t data) {
     if (result != SUCCESS)
       {
        data = 0xffff;
        report_problem();
       }
     local.reading = data;
   }


/* delete all uint8_t reading, the counter for number of sensor reading */


not sure what you mean by TSR? temperature sensor? the original code 
only wire the sensor reading to DemoSensor, which is a voltage sensor 
available on most of sensor platforms.

if my guess is right, you only need to check the Sensor component you 
are using and wire OscilloscopeC.Read to it. for example, you will wire

OscilloscopeC.Read -> new TempC() /* for temperature on MTS300/310 */
OscilloscopeC.Read -> new SensirionSht11C().Temperature /* for 
temperature on Tmote Sky */

regards;

Peizhao


Saif A. Al-Hiddabi wrote:
> Hi,
> 
>  
> 
> I need some help to modify the Oscilloscope application so that it reads 
> only the TSR sensor and not the entire set of sensors. I also need to 
> have one reading per packet sent. The current Oscilloscope application 
> sends 10 readings per packet for the six sensors and this makes the 
> application slow. I tried to see where this can be modified in 
> "OscilloscopeTmoteSkyM.nc" and "OscilloscopeTmoteSky.nc" but no luck and 
> things looks complicated in the code. Thanks in advance for any help.
> 
>  
> 
> Regards,
> 
>  
> 
> SAIF
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to