see my timer code for example usage:
http://www.etantdonnes.com/Motes/AVR128timers.zip

It may be that having the define before the declarations
confuses NESC. I have the ASSIGN after the globals in HPLT3captureM.nc

MS

Siddharth Trivedi wrote:
> To create my application I have simply modified the BlinkToRadio
> example from the tutorials. Now, in the BlinkToRadioC.nc module's
> implementation, I initially tried to directly place ASSIGN next to the
> counter declaration.
> 
> module BlinkToRadioC {
>  uses interface Boot;
>  uses interface Leds;
>  uses interface Timer<TMilli> as Timer0;
>  uses interface Packet;
>  uses interface AMPacket;
>  uses interface AMSend;
>  uses interface Receive;
>  uses interface SplitControl as AMControl;
>  uses interface GeneralIO as PortB5;
> }
> implementation {
>  TOSH_ASSIGN_PIN(XYZ, B, 5);
>  uint16_t counter;
>  message_t pkt;
> 
> This gave me the error :
> BlinkToRadioC.nc:55: syntax error before `5'
> BlinkToRadioC.nc:55: warning: return-type defaults to `int'
> BlinkToRadioC.nc:55: warning: data definition has no type or storage class
> 
> 
> The program also used TOSH_SET_XYZ_PIN();
> which gave the error : BlinkToRadioC.nc:134: implicit declaration of
> function `TOSH_SET_GIO3_PIN'
> 
> 
> Another thing, I assumed that since these macros may be defined in a
> header file I am not including, I chose another approach to tackle the
> problem. I wired the component HplAtm128GeneralIOC to BlinkToRadioC
> using the GeneralIO interface (with HplAtm128GeneralIOC's PortB5).
> Now, instead of using TOSH_SET etc., I did the following in
> boot.booted()
> call PortB5.makeoutput();
> This gave me an error : interface has no command or event named `makeoutput'
> however, PortB5.set(), PortB5.clr() and PortB5.get() functions do not
> give a compile time error.
> I have four questions:
> 1. Why was the earlier program not working? Am I missing something?
> 2. Where are the makeoutput() and makeinput() commands that should be
> defined if HplAtm128GeneralIOC is to provide the GeneralIO interface?
> 3. Will this 2nd arrangement work on the hardware?
> 4. If yes, does this mean that the same port can be used as an input
> and output port without having to explicitly change its direction?
> 
> Regards,
> Siddhartha.
> 
> On Thu, Mar 19, 2009 at 2:34 AM, Michael Schippling <[email protected]> wrote:
>> You can put the ASSIGN in any "global" context -- outside of a function
>> definition. The MAKE*OUTPUT would usually go in your init() or start()
>> functions. The SET and CLR go where you want them to set and clear stuff.
>> Search for uses of the sub strings, like "TOSH_SET", in the existing
>> code to see how they get used.
>>
>> MS
>>
>>
>> Siddharth Trivedi wrote:
>>> Hi everyone,
>>>
>>> I am trying to build a wireless switch using MICAZ motes, where an
>>> input at one mote causes a bulb to light up at another mote. The
>>> problem I am facing is one that I find has been discussed already on
>>> this forum, that of reading an input from an individual pin. From
>>> previous posts, I gather that any communication with a port can be
>>> carried out in the following three steps :
>>> 1. Assign a name to a port+pin.  - TOSH_ASSIGN_PIN(XYZ, B, 5);
>>> 2. State whether the pin is input or output. - TOSH_MAKE_XYZ_OUTPUT();
>>> 3. Set/Clear or Read the pin. - TOSH_SET_XYZ_PIN()
>>> I cannot understand how do I use these macros. My question is where in
>>> my code can I place them. Can I assign a port+pin anywhere in the
>>> implementation of my module? Will I have to include some header file
>>> to the module in which I am using these macros? Are there any
>>> examples/literature available for the atm128 microcontroller that can
>>> help me understand how to solve the issue of input/output from an an
>>> individual pin? I am extremely new to TinyOS and NesC, and any help
>>> would be most welcome.
>>>
>>> Regards,
>>> Siddhartha.
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> [email protected]
>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>> --
>> Platform: WinXP/Cygwin
>> TinyOS version: 1.x, Boomerang
>> Programmer: MIB510
>> Device(s): Mica2, MicaZ, Tmote
>> Sensor board: homebrew
>>
>>
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

-- 
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew

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

Reply via email to