On Tuesday 30 January 2007 19:51, Ankur Kamthe wrote:
> Hi all,
>
> I was trying to use the pins on the expansion connector for Tmote Sky
> on a project. I started by writing a simple program that would toggle
> one of the "Exclusive Digital I/O" pins but was not sure how to
> address/indentity a particular pin in TOS. In the program, I set a
> particular port for the ADC, set the pin as an output pin and toggle
> it. Everytime my pin toggles, one of the LEDs also toggles. When I try
> Port23 : Pin 3 of the 6-pin expansion connector toggles and for Port
> 26: pin 4 of the 6pin expansion connector toggles.
>
> Could someone point me to any resource which explains the pin mapping
> or explain this behavior?

Check out TEP 117.  A link is present on the front page of www.tinyos.net.

In your BlinkC.nc, you call Leds.ledXToggle() (where X is 0, 1, or 2) 
immediately after each call to GeneralIO.toggle(), so I think you should 
expect a LED to toggle each time your IO pin toggles.

> My aim is to toggle pin 7/10 on the 10 pin 
> expansion connector, which are dual purpose pins (primary: analog
> input 2, secondary: exclusive digital i/o). I am pasting the program I
> used to test the pins after this email.

Pin 7 ties to msp430 P6.2, which can be used for digial IO or ADC.  So, to 
toggle pin 7, simply change HplUserButtonC.nc to reference GeneralIOC.Port62 
instead of Port23.  You can find the datasheet for the TMote Sky at MoteIV's 
website.  It has a schematic which shows the routing of the connector pins.

>
> TestAppC.nc: Top Level Configuration File
> BlinkC.nc: Main Section which toggles the timer, leds and pins
> HplUserButtonC.nc: Wiring for I/O pin
>
> thanks,
> ankur
>
>
> 1. Makefile
> COMPONENT=TestAppC
> include $(MAKERULES)
>
> 2. TestAppC.nc
> configuration TestAppC
> {
> }
> implementation
> {
>   components MainC, BlinkC, LedsC;
>   components new TimerMilliC() as Timer0;
>   components new TimerMilliC() as Timer1;
>   components new TimerMilliC() as Timer2;
>
>   BlinkC -> MainC.Boot;
>
>   BlinkC.Timer0 -> Timer0;
>   BlinkC.Timer1 -> Timer1;
>   BlinkC.Timer2 -> Timer2;
>   BlinkC.Leds -> LedsC;
>
>   components HplUserButtonC;
>       BlinkC.GeneralIO -> HplUserButtonC.GeneralIO;
> }
>
> 3. BlinkC.nc
> #include "Timer.h"
>
> module BlinkC
> {
>       uses interface GeneralIO;
>
>   uses interface Timer<TMilli> as Timer0;
>   uses interface Timer<TMilli> as Timer1;
>   uses interface Timer<TMilli> as Timer2;
>   uses interface Leds;
>   uses interface Boot;
> }
> implementation
> {
>
>   event void Boot.booted()
>   {
>     call GeneralIO.makeOutput();
>     if(call GeneralIO.isOutput()){
>       call Timer2.startPeriodic( 5000 );
>     }
>     else{
>       call Timer1.startPeriodic( 1000 );
>       call Timer0.startPeriodic( 2000 );
>     }
>   }
>
>   event void Timer0.fired()
>   {
>     dbg("BlinkC", "Timer 0 fired @ %s.\n", sim_time_string());
>     call GeneralIO.toggle();
>     call Leds.led0Toggle();
>
>   }
>
>   event void Timer1.fired()
>   {
>     dbg("BlinkC", "Timer 1 fired @ %s \n", sim_time_string());
>     call GeneralIO.toggle();
>     call Leds.led1Toggle();
>   }
>
>   event void Timer2.fired()
>   {
>     dbg("BlinkC", "Timer 2 fired @ %s.\n", sim_time_string());
>     call GeneralIO.toggle();
>     call Leds.led2Toggle();
>   }
> }
>
> 4. HplUserButtonC.nc
> configuration HplUserButtonC {
>   provides interface GeneralIO;
> }
> implementation {
>
>   components HplMsp430GeneralIOC as GeneralIOC;
>
>   components new Msp430GpioC() as TogglePinC;
>   TogglePinC -> GeneralIOC.Port23;
>   GeneralIO = TogglePinC;
>
> }
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
> !DSPAM:45c022d1169181542430122!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to