This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to define a bit variable at a specific bit location?

Hi,

I'm trying to define a bit variable at a specific bit location.

I tried the following without succes:

       BSEG AT 02FH.7
MYBIT: DBIT 1
The linker complains with
*** ERROR L107: ADDRESS SPACE OVERFLOW
SPACE: BIT
SEGMENT: ?BI??TEST?1
LENGTH: 000000H.1

The following works but the linker is assigning the address (and that is not what I want):
TEST_BIT SEGMENT BIT
       RSEG TEST_BIT
MYBIT: DBIT 1

Or I could assign the whole byte and then target the bit that I want (but then I have 7 unused bits):

       DSEG AT 02FH
MYBIT8: DS 1
sbit MYBIT=MYBIT8^7;

Shouldn't the first version work?

Geert

Parents
  • Erik,

           DSEG AT 02FH
    MYBITB8: DS 1
    sbit MYBITF8=MYBITB8^0;
    .....
    sbit MYBITFf=MYBITB8^7;
    
    This is also a valid option, but this way I have 7 unused bits which will not be used anymore for assignment by the linker, and I don't want to wast bits ;-)

    sbit MYBIT 0f8h;
    
    This will not stop the linker for re-assigning this bit to another bit variable. (Or am i wrong here?)

    According to the A51-documentation (P112) the declaration should however work with BSEG AT:
    BSEG AT 30h ; absolute bit segment @ 30h
    DEC_FLAG: DBIT 1 ; absolute bit
    INC_FLAG: DBIT 1
    
    The syntax is indeed correct, but is there something more to do to avoid the link error?

    Geert

Reply
  • Erik,

           DSEG AT 02FH
    MYBITB8: DS 1
    sbit MYBITF8=MYBITB8^0;
    .....
    sbit MYBITFf=MYBITB8^7;
    
    This is also a valid option, but this way I have 7 unused bits which will not be used anymore for assignment by the linker, and I don't want to wast bits ;-)

    sbit MYBIT 0f8h;
    
    This will not stop the linker for re-assigning this bit to another bit variable. (Or am i wrong here?)

    According to the A51-documentation (P112) the declaration should however work with BSEG AT:
    BSEG AT 30h ; absolute bit segment @ 30h
    DEC_FLAG: DBIT 1 ; absolute bit
    INC_FLAG: DBIT 1
    
    The syntax is indeed correct, but is there something more to do to avoid the link error?

    Geert

Children