Thanks, They are pulled up to +5v via 1K. I just tried the single '!' and none light.The base address and offset I understood, the suggestion LED1 = !(pkt_cntr=1) and so on I do not understand. Care to enlighten?
Thanks, They are pulled up to +5v via 1K. I just tried the single '!' and none light.The base address and offset I understood, the suggestion LED1 = !(pkt_cntr=1) and so on I do not understand. Care to enlighten?
"If we knew what we were doing, it wouldn't be called research"
- Albert Einstein
Darrel-Your add DOES work. SOmehow my variable 'pkt_cntr' is getting weird values like $94, $46, $19, $C0. Strange for such a simple counter.I will continue to look into it.I would like to fully understand the command 'LED1 = !(pkt_cntr=1) so I can learn.....Thanks and Regards,Ecoli-557
"If we knew what we were doing, it wouldn't be called research"
- Albert Einstein
Yes, it does work.
But you seem to come to those conclusions while I'm working on something to prove it.
That's twice now today.
>> .I would like to fully understand the command 'LED1 = !(pkt_cntr=1) so I can learn
Think about it. Then tell me how it works.
![]()
DT
Sorry about my misplaced enthusiasm..... I have a few days to fool around with this without too much interruption and I get excited. My apologies.
Re the boolian math, I get the inversion, but I don't think I get the connection written the way it is.LED1 (the port) = (will follow) ! (NOT or inverse of) (pkt_cntr=1) <-- here is where I get fuzzy.
We take the inverse of the variable which is hard-coded but which is in a loop which is increased each time I get a packet?? I am befuddled. I will takes my whippin' now.....
I do understans the NOT of the port pin so the LED will fire, what I don't see is the hard-code inside a loop which is increasing the var??
Last edited by ecoli-557; - 12th March 2012 at 20:20. Reason: battery died.
"If we knew what we were doing, it wouldn't be called research"
- Albert Einstein
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
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
Bookmarks