|ARM Technical Support Knowledge Articles|
Applies to: A51 Macro Assembler
Information in this article applies to:
I'm porting an existing assembler program from another vendor's tools to the Keil A51 Assembler. For example, the following instructions:
PUSH A POP A CPL A.0 SETB A.7 JNB A.7,TIME_CUT_1
generate the following error message:
Error 22: Expression type does not match instruction
What must I do to port this code?
The original Intel 8051 documentation makes a clear distinction between the accumulator register (A) and the accumulator SFR (ACC). Both allow you to change the accumulator, however, only the SFR may be used with some instructions.
The instructions you list take a direct memory address (or SFR) as their targets. So, to access the accumulator with these instructions, you must provide the address of the accumulator SFR instead of the A (accumulator) register. ACC is the mnemonic to use for the accumulator SFR.
Make the following changes to port your program:
PUSH ACC POP ACC CPL ACC.0 SETB ACC.7 JNB ACC.7,TIME_CUT_1
Note that ACC and A both refer to the accumulator, but ACC allows you to supply the SFR address to those assembler instructions that require a direct memory address.
Article last edited on: 2006-10-29 19:07:47
Did you find this article helpful? Yes No
How can we improve this article?