Keil Logo

GENERAL: SYSTEM ARCHITECTURE AND ASSEMBLY PROGRAMMING


Information in this article applies to:

  • C251 all Versions
  • C51 all Versions

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 µVision2 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 \KEIL\C51\EXAMPLES\ASM folder. You may use the µVision2 Debugger/Simulator to test this small example program.

The Keil C51 toolchain comes with an assembler file template (\KEIL\C51\ASM\TEMPLATE.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

Last Reviewed: Friday, June 2, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.