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?
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.
Dave
Always wear safety glasses while programming.
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
Last edited by mister_e; - 25th January 2011 at 00:45. Reason: How2Read
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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?
Sorry I'd edit the post while you replied. Seems you got the idea though![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks