[En-Nut-Discussion] Simple question about AT91SAM7X-EK

Tim DeBaillie debaillie at ciholas.com
Fri Nov 3 17:07:35 CET 2006

On Thu, 2 Nov 2006, Matt Wood wrote:

> Hi everybody, this is a simple question I'm sure, but its always the 
> stupid one's that are the hardest for me :)  I cant seem to understand 
> how to use the GPIO on the SAM7X board with Nut/OS.  All I want to be 
> able to do is to turn a LED on and off, and sample input from the 
> joystick switch.  The Nut/OS API docs are a little confusing to me and 
> there is no example of this in any of the included exampmle programs. 
> They do all the complicated stuff though.  Could someone please provide 
> a code example for port I/O control on the SAM7X-EK board?  Thanks in 
> advance.  Matt.

Tunrs on an LED at pin PB20, which is on the SAM7x256 Eval Kit.

outr(PIOB_PER, 0x00100000); //enable pio control
outr(PIOB_OER, 0x00100000); //enable the output on the I/O line
outr(PIOB_SODR, 0x00100000); //enable the led

then to turn it off, you just do

outr(PIOB_CODR, 0x00100000); //disable the led


More information about the En-Nut-Discussion mailing list