Hi
here is a code i used, but not sure is the best way to do this. It will output on port 62 (exclusive digital /IO 1) the input read on port 63 (exclusive digital I/O 0). You can sample data with a timer too, this is just the minimum to use Gpio.
Hope it will be useful.


configuration TestGpioC
{
}
implementation
{
   components TestGpioP as App;
components HplMsp430GeneralIOC as GeneralIOC;

   components new Msp430GpioC() as in;
   in -> GeneralIOC.Port63;
   App.inIO -> in;
components new Msp430GpioC() as out;
   out -> GeneralIOC.Port62;
App.outIO -> out;
   components MainC;
App.Boot -> MainC.Boot; }

-----------------------------------------------------------------------------------------------
module TestGpioP
{
   uses{
       interface GeneralIO as inIO;
       interface GeneralIO as outIO;
       interface Boot;

} }

implementation
{

   bool up = FALSE;

event void Boot.booted()
   {
       call inIO.makeInput();
       call outIO.makeOutput();
       atomic
       {
           while(TRUE)
           {



               up = call inIO.get();
if( up )
                   call outIO.set();
               else
                   call outIO.clr();
}
       }

}
}


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

Reply via email to