Hi,

Try this :

in moduleC :

module BlablaC {
  uses interface Boot;
  uses interface GeneralIO as DigitalInputPin;
  // etc..
}
implementation {
  event void Boot.booted() 
  {
    DigitalIOPin.makeInput(); // DDRx &= ~(1 << x)
    DigitalIOPin.set(); // PORTx |= (1 << x)
  }

  task void readInput() {
    bool digitalInput = call DigitalIOPin.get();
  }
  // the rest of your program
  // ....
}

in configurationAppC :
configuration BlablaAppC {
}
implementation {
  components BlablaC,MainC;
  BlablaC.Boot              -> MainC;
  
  components HplAtm128GeneralIOC as ATMega128Pin;
  BlablaC.DigitalInputPin -> ATMega128Pin.PortA4;
}

I think it's quite portable, since you can replace the 
HplAtm128GeneralIOC with the MSP's component 
( sorry I don't know what's the counter part for the MSP).

Regards,

-daniel

-------- Original Message --------
> From: "Tom Apker" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 25, 2007 6:38 AM
> To: [email protected]
> Subject: [Tinyos-help] Quadrature encoder
> 
> Good day eveyone,
> 
>     I've just started working on a quadrature encoder program for a mica2
> mote, and I'm having some trouble figuring out how to access the individual
> external pins.  It looks like I should be using the Get interface to get the
> value of (I think) Port A pins 4&5, which I will sample at a fairly high
> rate using one of the timers.
> 
>     Two questions:
> 
>     (1) How do I wire the external pins so that I can sample them with a Get
> (or similar) command? (example code would be helpful here)
> 
>     (2) Is it possible to make this more general than just the mica2, or
> even atm chips?  I figure I won't be the last guy to do this, so I'd rather
> do it right the first time.
> 
> Many thanks,
> 
> -tba




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

Reply via email to