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.
Bookmarks