Keil Logo

A51: ERROR A17 (INVALID BYTE BASE IN BIT ADDRESS EXPRESSION)


Information in this article applies to:

  • C51 Version 5.50a
  • C51 Version 6.12

QUESTION

I've written a simple assembly program as follows:

cseg    at      0
        setb    1Fh.7
end

However, this program assembles with the following error message:

*** ERROR #A17 IN 5 (MYPROG.A51, LINE 5): INVALID BYTE BASE IN BIT ADDRESS EXPRESSION

How to I address bits with the assembler?

ANSWER

The 8051 supports 256 addressable bits.

The first 128 bits (bit addresses 0x00-0x7F) are located in the data memory from byte address 0x20 to 0x2F. You may use the bit address or the dotted byte address. For example, the following two instructions:

        setb    0Ah
        setb    21h.2

set the same bit.

The last 128 bits (bit addresses 0x80-0xFF) are located in the SFR memory at SFR addresses 0x80, 0x88, 0x90, 0x98, 0xA0, 0xA8, 0xB0, 0xB8, 0xC0, 0xC8, 0xD0, 0xD8, 0xE0, 0xE8, 0xF0, and 0xF8. For example, the following two instructions:

        setb    0B0h.2
        setb    0B2h

set bit 2 on Port 3.

The error you receive indicates that the byte address you have provided is not valid for bit operations. In you example, 1Fh.7 is not a valid bit address. The bit addressable bits must be within the range of 0x20 to 0x2F for the data memory. If you specify a byte address between these values, your instruction will work.

MORE INFORMATION

  • Refer to Chapter 8. Error Messages in the A51/A251 Assembler User's Guide for more information about this error message.
  • Refer to SETB in the 8051 Instruction Set Manual.

SEE ALSO

Last Reviewed: Thursday, September 22, 2005


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.