Keil Logo

A51: Addressing Bits and Bytes


Information in this article applies to:

  • A51 Version 5.50 and later

QUESTION

How do I address a bit-addressable byte as both bits and a byte in assembly?

ANSWER

Here is the code that shows the code for addressing bit addressable internal memory as bits and bytes

NAME    TEST

?PR?main?TEST        SEGMENT CODE
?BA?TEST             SEGMENT DATA BITADDRESSABLE
        EXTRN   CODE (?C_STARTUP)
        PUBLIC  bit0
        PUBLIC  byte
        PUBLIC  main

        RSEG  ?BA?TEST
           byte:   DS   1
bit0    EQU     (byte+0).0

        RSEG  ?PR?main?TEST
        USING   0
main:
        SETB    bit0
?C0001:
        SJMP    ?C0001
        RET

        END

MORE INFORMATION

To add other bits just duplicate the EQU to represent the remaining locations.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


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.