Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I'm new to microcontroller programming. How can i configure one pin for input and another for output. If I am not wrong this could be done with GPIO registers that control device pins that are not connected to peripheral functions.

share|improve this question

2 Answers

If you don't find the complete information in the datasheet you'll have to look at the LPC17xx family user manual. We're interested in Chapter 9: "LPC17xx General Purpose Input/Output (GPIO)". There you can read that FIODIR is the

Fast GPIO Port Direction control register. This register individually controls the direction of each port pin.

The direction for each I/O port/pin is controlled by FIO0DIR through FIO4DIR. Page 122 gives you the corresponding addresses.

If you don't know how to start looking in these rather long documents, use the "find" function in Acrobat Reader (CTRL-F) and look for "Direction".

share|improve this answer
You may also need to read chapter 8 "Pin connect block". – starblue Oct 2 '11 at 17:30
thx a lot ... And one more question : where i can get some sample code with arm cortex m3 programming ?? – devXcode Oct 2 '11 at 20:38
The corresponding CMSIS library has many demos, see also: stackoverflow.com/questions/7626102/… – Turbo J Oct 2 '11 at 20:55

Looking at the User Manual, it seems you would use the FIODIR register mentioned on pages 122-123.
There will be other things that affect the pins like the peripheral settings and Pin Function Select (see p104) so be sure to read the manual thoroughly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.