ARM Technical Support Knowledge Articles

ACCESSING I/O PORTS IN C

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

How can I access the I/O ports on the 8051 using C? Is there an include file that is needed?

ANSWER

Yes.

You must include the SFR register definition include files. These are found in the C51INC folder and usually have names like REG51.H (for the standard 8051), REG52.H (for the 8052), and so on. There are include files for most of the derivatives currently available.

In uVision, you can right click the mouse in the Edit Window. An option to automatically insert the #include for the correct header file is available there.

There are several example programa that may be helpful.

Article last edited on: 2005-07-22 15:16:24

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential