All bit functions use absolute bit addressing.The absolute bit address is the address of the bit within the PIC data space.
Each byte (RAM or SFR location) within the PIC data space has a unique address.
The relative address of a bit within a data byte is between 0 and 7 and is relative to the byte.
BYTE relative BIT address 63 7 6 5 4 3 2 1 0 64 7 6 5 4 3 2 1 0 65 7 6 5 4 3 2 1 0 66 7 6 5 4 3 2 1 0 The absolute address of a bit within the entire data space is between 0 and 65535 The absolute bit address is calculated as ((N * 8) + M) where N is the byte address of the byte within the PIC data space and M is the relative bit address of the bit within byte N
BYTE absolute BIT address 63 511 510 509 508 507 506 505 504 64 519 518 517 516 515 514 513 512 65 527 526 525 524 523 522 521 520 66 535 534 533 532 531 530 529 528 NOTE: XCSB can accomodate absolute bit addresses upto 32 bit but given that currently no PICs are available with more than 8K of RAM the user is advised to use 16 bit variables to manipulate absolute bit addresses.
NOTE2: XCSB can efficiently convert constant absolute bit addresses to single PIC instructions.
The expression ((&PORTA * 8) + 3) has no runtime overhead when used as an argument to the set_bit, reset_bit and test_bit functionse.g.
set_bit(((&PORTA * 8) + 3))generates only 1 PIC instructionif test_bit(((&PORTA * 8) + 3)) != 0 thengenerates only 2 PIC instructionsconstant absolute bit addresses can be carried efficiently through function calls if the called function is defined as inline. If the called function is not defined as inline then there is a runtime overhead invloved in accessing the byte where the bit is located then the bit itself. The user cannot define functions as inline within the LITE edition of XCSB. This is a restricted feature. However the set_bit, reset_bit and test_bit library functions defined within bit_lib.bas are not restricted and are defined as inline functions.