In an application, I have wired the lower 4 bits of PORTF to control the inputs of a multiplexer. Right now I have assigned the variable like this:
MUX VAR PORTF
but really, it's only the lower 4 bits. How can I specify that in my declaration?
Printable View
In an application, I have wired the lower 4 bits of PORTF to control the inputs of a multiplexer. Right now I have assigned the variable like this:
MUX VAR PORTF
but really, it's only the lower 4 bits. How can I specify that in my declaration?
Look at section 4.10 in the manual.
There's no specific variable type for that. Usually a Shadow register & some BYTEWise operation solve many issue. Something around ....
When dealing with port, you may want to avoid successive bit modification to avoid RMW effect.Code:MUX VAR PORTF
S VAR BYTE
S = (MUX & $F0) | ValueToWrite
MUX = S
To read a PORT it's easier
Code:MUX VAR PORTF
S VAR BYTE
S = MUX & $0F
I see how I can isolate the lower 4 bits of a port and READ from them
anyvar = PORTF & $0f
but don't know how that pertains to a WRITE. Is that what you mean?
thank you mister_e.
Sorry I'd edit the post while you replied. Seems you got the idea though ;)