ShiftIn to array of bits using EXT modifier?


Results 1 to 3 of 3

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: ShiftIn to array of bits using EXT modifier?

    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,

    .
    Last edited by Darrel Taylor; - 11th March 2011 at 14:44.
    DT

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts