[Tinyos-help] Writing to P2.3 and P2.6
Urs Hunkeler
uhu at gmx.ch
Sat Dec 13 04:14:20 PST 2008
Hi,
Couldn't you use the Gpio interfaces in something like the example below?
In the configuration:
components new Msp430GpioC();
components HplMsp430GeneralIOC;
Msp430GpioC.HplGeneralIO -> HplMsp430GeneralIOC.Port62;
MyAppC.Pin -> Msp430GpioC;
Then, in the module use the GeneralIO interface:
interface GeneralIO as Pin;
Then you should be able to to set the pin to high/low with the following
calls:
call Pin.set();
call Pin.clr();
Cheers,
Urs
Michael Schippling wrote:
> Lets keep this on the help list in case someone actually knows something...
>
> I suspect that you can't do that because the memory spaces are not
> the same. Look at the controller manual for the instructions that
> read and write port registers, and then see if you can find equivalent
> C'ish macros. I'm too lazy to re-find where outp() is defined for
> the atmega but I think its in the compiler header files rather than
> the TOS files. For the MSP I expect there is something similar.
> Spot checking hardware interface .nc files may provide clues.
>
> MS
>
>
> Donde Vas wrote:
>> Thank you Michael for your input. I was wondering if you knew if I can
>> use something
>> like the following in TinyOs1. I have tried but it does not work; it
>> compiles OK tough. I'm playing trying to set all the Leds at once:
>>
>> atomic (*(volatile uint8_t *)0x32) |= 0x70; // Sets for output
>> atomic (*(volatile uint8_t *)0x33) &= 0x8F; // Sets for IO
>> atomic (*(volatile uint8_t *)0x31) |= 0x70; // Sets pins 4,5,6
>> of port 5
>>
>> Regards,
>>
>> LV
>>
>>
>> --- On *Fri, 12/12/08, Michael Schippling /<schip at santafe.edu>/* wrote:
>>
>> From: Michael Schippling <schip at santafe.edu>
>> Subject: Re: [Tinyos-help] Writing to P2.3 and P2.6
>> To: lamevas at yahoo.com
>> Cc: tinyos-help at millennium.berkeley.edu
>> Date: Friday, December 12, 2008, 4:53 PM
>>
>> You should be able to write a full byte to the port 2 register
>> but you'll have to do a little code archeology to figure out
>> what function to use. E.g., in T1 for micas I use:
>> outp( value, portaddr );
>>
>> Also you need to make sure you don't twiddle anything attached
>> to the other bits on the port.
>>
>> MS
>>
>> Donde Vas wrote:
>> > Hope someone can shed a light on this: I'm writing a TinyOS telosb
>> application which needs to use P2.3 (GIO2) and P2.6 (GIO3). Is there a command
>> in TinyOS that can write to these addresses at once? (there must be no delay
>> between them). Using MSP430GeneralIOC.Port23 and MSP430GeneralIOC.Port26 gives
>> a delay of some microseconds, which is not acceptable.
>> >
>> > Any suggestions? An example would be great.
>> >
>>
>> > Thanks!
>> >
>> > Lane
More information about the Tinyos-help
mailing list