On Mon, Oct 28, 2013 at 3:50 AM, Alaios <[email protected]> wrote:

> Hi thanks for the answers Erik,
>

Its Eric.   no biggie though.   Just not Nordic.   Originally it was
supposed to germanic, Erich, but the h got dropped somewhere.


>
> a. do you know where I can read regarding variable scoping in tinyos?
>

nope.   you can try reading the book by Phil and David.   It is also
helpful to look at an example app.c to see how the modules get put together
and how the naming works.

I figured it out myself.



> If I understand it right a variable declared inside an event  or command
> would be just visible within that scope?
>

That is correct.  Events and Commands are just special instances of C
procedures.   So parameters as well as local vars have local scope.


> If one variable has to be visible
>

I don't know what you mean by visible?   Module global?

Then yes.   It also makes it static meaning static allocation as opposed to
dynamic allocation.   Local vars as well as parameters only live for a
short time and then disappear.  Hence the local scoping.


> has to be defined at the beginning of the module.. Is that right? What
> about the static keyword you mentioned earlier?
>

I wasn't mentioning it as a keyword but rather as a type of allocation.


>
> b. Regarding conversion formula for the luminance , I am not asking a
> favor I am trying to find this myself. I googled it, I found the hardware
> component name and look on the manufacturer web site. Where else in this
> world should I look for that? I am trying, still to built up understanding
>

If I were solving the problem you are talking about, I would be doing the
same thing.   So you are on the right track.  You just need to put it
together.

If you were using that piece of h/w, how would you as a person go about
solving the problem?


>
> Have a nice day
> Alex
>
>
>
>   On Monday, October 28, 2013 11:32 AM, Eric Decker <[email protected]>
> wrote:
>
>
>
> On Mon, Oct 28, 2013 at 2:33 AM, Alaios <[email protected]> wrote:
>
> Hi,
> I appreciate the answer you gave me.
>
> A. If it has to do with scoping why nesC does not complain for the printf
> statement, that has a variable with no assigned value?
>
>
> no idea and I'm not going to spend the time to figure it out.
>
> probably because it is static, which means that C knows that is is
> initialized on start up.   Either zero'd (which is what happens in this
> case) or pre-initialized.
>
>
>  What instead of a static variable declaration do a variable declaration
> inside the readDone?
>
>
> I have no idea what you are trying to say in the above sentence.    It
> doesn't parse.
>
> I am kind of sure that doing the calculations inside the printf("%d",2+3)
> would work in todays C compiliers
>
>
> yes.
>
>
>
> B. I also looked on the light sensor my telosb has but I could not find
> anywhere documented the conversion formula being used over the same video.
> Where one can find this conversion formula? I was able to find the
> temperature and humidity conversion formulas from the official datasheet of
> the chip producer.
>
>
> you'll have to figure this one out yourself.   I don't have time to figure
> it out.
>
>
>
>
> I would like to thank you in advance for your help
>
> Regards
> Alex
>
>
>
>   On Monday, October 28, 2013 10:23 AM, Eric Decker <[email protected]>
> wrote:
>
>
>
> On Mon, Oct 28, 2013 at 2:02 AM, Alaios <[email protected]> wrote:
>
> Hi I was looking in the nice tutorial here
>
> http://www.youtube.com/watch?v=x0g4uFr44rk
>
> and I was wondering why at 34:11 we have to declare one more variable for
> the conversion formula to work. I guess this is related to the way tinyos
> works internally.
>
>
> Its not an advanced topic.   Rather it is a C variable scoping topic.
>
> it also has nothing with making the conversion formula work.
>
> It does have everything to do with C scoping of variables.
>
> TempRead.readDone is an event that gets signalled by the h/w driver.  It
> is basically a call out and you have to have some place to put what you
> compute from the value the read gives you.  The value passed in by the
> driver (when calling (signalling) readDone) is call local.  its either in
> registers or on the stack.   Doesn't have a very long lifetime.
>
> So one way is to define a module static, centiGrade.   That gets the
> computation value.
>
> That is what the tutorial guy is doing by defining the module static
> centiGrade.   Because it is inside the implementation block of the module
> its name will be munged by nesc to make sure it is program unique.
>
>
>
>
>
> Can someone shed light on such advanced topic?
>
> R
> Alex
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
>
> --
> Eric B. Decker
> Senior (over 50 :-) Researcher
>
>
>
>
>
>
>
> --
> Eric B. Decker
> Senior (over 50 :-) Researcher
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>


-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to