Keil Logo Arm Logo

BIT Assembler Statement

Arguments
symbol BIT address
Description

The BIT statement assigns an address (in the range 20h-2Fh or an 8051 bit-addressable SFR) to the specified symbol. The symbol may not be redefined.

In addition, the BIT statement may create a bit name for the following bit-addressable items:

  • Absolute addresses from 20H.0-2FH.7. For example, 23H.2.
  • SFR bits which are in the bit-addressable space. For example, P3.3, or PSW.7. This creates an absolute bit because SFR symbols are absolute.
  • Bits based on bytes contained in bit-addressable data sections. This results in relocatable bits if the bit-addressable data section is relocatable.
See Also

BSEG, CODE, DATA, IDATA, XDATA

Example
DATA_SEG        SEGMENT DATA BITADDRESSABLE

RSEG            DATA_SEG              ; Relocatable
                                      ; bit-addressable
                                      ; segment

BITS:           DS      1             ; A 1-byte
                                      ; bit-addressable
                                      ; variable

ALARM           BIT     BITS.0        ; Bit 0 in BITS
D1_OPEN         BIT     ALARM+1       ; Bit 1 in BITS
D2_OPEN         BIT     ALARM+2       ; Bit 2 in BITS

P1_2            BIT     90h.2         ; SFR P1.2

Keil logo

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.