Keil Logo

A51: ERROR 22 (EXPRESSION TYPE DOES NOT MATCH INSTRUCTION)


Information in this article applies to:

  • C51 Version 5.50a
  • C51 Version 6.12

QUESTION

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?

ANSWER

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.

MORE INFORMATION

Last Reviewed: Sunday, October 29, 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.