|
|
 | | From: | Mayank Kaushik | | Subject: | at91: accessing the individual pins of the PIO | | Date: | 6 Jan 2005 02:38:29 -0800 |
|
|
 | Hi,
im using the at91rm9200, iv just migrated from the 89c51. i want to know if it is possible to assign a value to only one pin of the pio..i mean like in the 89c51 using the sdcc compiler, i could send a bit to just one pin, without sending any value to the other pins..can i do that with this controller?
thanx in anticipation
Mayank
|
|
 | | From: | Tauno Voipio | | Subject: | Re: at91: accessing the individual pins of the PIO | | Date: | Thu, 06 Jan 2005 17:15:42 GMT |
|
|
 | Mayank Kaushik wrote: > Hi, > > im using the at91rm9200, iv just migrated from the 89c51. i want to > know if it is possible to assign a value to only one pin of the pio..i > mean like in the 89c51 using the sdcc compiler, i could send a bit to > just one pin, without sending any value to the other pins..can i do > that with this controller? >
Yes.
Get the controller manual and read the chapter on PIO.
The PIO registers are controlled in set/reset way: there is one I/O port which controls setting on the register bits and another port which controls setting off the register bits.
Just write a bit pattern with ones in positions you want to '1' to the set port, and another pattern with ones in positions you want to set to '0' to the reset port.
Assuming you have a bit mask with ones in the positions you want to control, and the value you want to the controlled bits in pattern:
- write (mask & pattern) to the set port - write (mask & ~pattern) to the reset port.
--
Tauno Voipio tauno voipio (at) iki fi
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: at91: accessing the individual pins of the PIO | | Date: | 6 Jan 2005 20:50:14 -0800 |
|
|
 | okay, thanks..
|
|
|