Hi Henrik,
BYTE and WORD variables only have one value that is a pointer to an address in RAM.
But BIT's and BIT arrays have two parameters ... the address, and a pointer to the bit in that address, because PBP can combine BIT arrays into single bytes if they are small enough. This makes it difficult to locate the beginning of the array since MyBitArray(0) may start at bit5 of the byte it's located in. These are located in PB01 type variables that PBP creates.
Fortunately, if the BIT array is more than 8 bits, PBP will will create a PBA01 type variable and the first bit will always start at bit0.
In ASM, a BIT array is aliased like this ...
#define _MB_Inputs PBA01,0
You have to strip off the ,0 to be able to assign it to an EXT var.
Code:
MB_Inputs VAR BIT[16]
DataIn VAR WORD EXT
@ #define Reg(Areg,Abit) Areg
@DataIn = Reg(_MB_Inputs)
The #define creates a "function" that only returns the register part of the BIT alias.
So DataIn will be assigned to PBA01 without the ,0.
HTH,
.
Bookmarks