ARM Technical Support Knowledge Articles

SYSTEM ARCHITECTURE AND ASSEMBLY PROGRAMMING

Applies to: General Topics

Answer


Information in this article applies to:


QUESTION

I'm new to the 8051 and I need to understand more about the CPU architecture. Is there any good literature available to get a better understanding for the hardware and the instruction set?

My questions are:

  1. What is the difference between ACC and A?
  2. What is the best way to structure an assembler program?
  3. How can I write interrupt service routines in Assembler?
  4. What is required to reserve space for a register bank?

ANSWER

First, you should obtain a detailed understand of the 8051 hardware architecture. One of the best documents on this subject is the original Intel MCS(R) 51 Microcontroller Family User's Manual. This manual is available from the Intel Web Site.

Chapter 1: MCS 51 Family of Microcontrollers Architectural Overview answers your first question, "What is the difference between ACC and A?". In the Addressing Modes section, it clearly explains REGISTER SPECIFIC INSTRUCTIONS where the Accumulator is referred as A and DIRECT ADDRESSING where ACC is used to specify the SFR address of the Accumulator. Chapter 2: Programmer's Guide and Instruction Set provides a complete description of all CPU instructions. Here you will see that some instructions are only available with DIRECT ADDRESSING. For example, there is no instruction to PUSH the Accumulator. However, you can PUSH the ACC SFR (which effectively does the same thing).

Next, you should start writing assembler programs with a good quality toolset (like the Keil 8051 Development Tools). If you do not already have the Keil tools you may download the C51 Evaluation Tools. The Keil tools come with the uVision2 Getting Started User's Guide which provides the information required to operate the tools. The Assembler/Utilities User's Guide presents all the Assembler and Linker directives. A complete assembler project is provided in the KEILC51EXAMPLESASM folder. You may use the uVision2 Debugger/Simulator to test this small example program.

The Keil C51 toolchain comes with an assembler file template (KEILC51ASMTEMPLATE.A51) that provides a good starting point for structuring modular assembler programs. Refer to this template for answers to your final three questions.

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-06-02 12:38:06

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