Thanks Steve.
But what is this doing? I mean is it assigning pins 1 thru 4 to the CHSEL label?
And "Bitwise Mask". I don't see that in the manual. What does it mean?
There's got to be an easier way to do this than having to insert that line every time.
What is the best way to assign input pins to a register in PBP?
For that matter, how do you assign anything to a register in PBP. Can't find that in the manual either!
CHSEL VAR PORTA
This will assign the whole PORTA, all the time to chsel variable... it's a simple alias. Still, it's the WHOLE PORTA reading, you still need to remove the bit you don't want/need.
If you want to assign a single pin to a variable
A_SINGLE_PIN VAR PORTA.0
As far as I'm aware of, there's no shortcuts. Bitwise & Logical mask/operations are indeed listed in the manual, not explained as it's a basic knowledge you should already be aware of when programming. Case not, there's Wikipedia & Google
http://en.wikipedia.org/wiki/Bitwise_operation
http://www.ralphb.net/IPSubnet/logical.html
and so forth
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
chsel var byte
'
'
'
'
chsel = (PORTA>>1) & $0F
this read PORTA, shift the whole value one place to the right (to remove PORTA.0), then isolate the 4 lower bits.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Really close
chsel = PORTA & %00001111
you're on the right direction!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks