A51: ERROR 22 (EXPRESSION TYPE DOES NOT MATCH INSTRUCTION)
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.
Last Reviewed: Sunday, October 29, 2006
of your data.