Index a bit through a portion of a port


Closed Thread
Results 1 to 17 of 17

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Index a bit through a portion of a port

    LED1 = !(pkt_cntr=1)

    pkt_cntr=1 gives a "Logical" result of True or False.
    Logical results can't be assigned to a BIT value.

    The ! (NOT) will convert a Logical Value to a BIT value (0 or 1), but the logic is inverted due to the NOT.
    Using two !! changes to a non-inverted bitwise value.

    With your LED's tied to VDD, you need the inverted version, which gives either a 1 or 0 according to the Logical comparison.
    So the LED will be ON when the comparison evaluates True.

    With all 4 of the LEDs given a different comparison, only one of them will be ON at a time.
    DT

  2. #2
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Re: Index a bit through a portion of a port

    Darrel-
    Thanks for that. I was not aware that PBP could separate logical from actual or physical values. Trying to do this has allowed me to learn 2 more things, one which is not documented, and one which was overlooked.
    Thanks again,
    Steve
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

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