|ARM Technical Support Knowledge Articles|
Applies to: A51 Macro Assembler
Information in this article applies to:
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?
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.
Article last edited on: 2005-09-22 11:27:44
Did you find this article helpful? Yes No
How can we improve this article?