Hi All,

I have some code that works around using 4bit(nibbles) to process the code.

Since there's no 'Nibble" option when configuring the VAR varaiables i wonder how i go about accessing 1/2 ports easily????

Here's the basic idea i have so far:

Code:
TRISB = 000000        ;set PortB as all OUTputs

                            ;assign some variable names
LO_nibble var byte        ;(i wish this could become a 'nibble' option someday)
HI_nibble var byte        ;(i wish this could become a 'nibble' option someday)

LO_nibble = PORTB & 001111  ;set "LO_nibble" to access the LSB 4 bits of PortB
HI_nibble = PORTB & 110000  ;set "HI_nibble" to access the MSB 4 bits of PortB

LO_nibble = 11 ; this should set the LSB 4 bits of PortB to whatever value chosen?
HI_nibble = 11 ; this should set the MSB 4 bits of PortB to whatever value chosen?
I know i can isolate/mask bits to only READ 4 bits into a variable, but what do i do to only ensure 4bits are WRITTEN to the 1/2-port??
I know i'm sort of close lol ;-)
Am i to do something like isolating the variable name to eliminate 4 bits?

If i want to write a 4 bit nibble to the LSB/MSB 1/2 of a port, is it going to write an entire byte to the port instead?
Basically the port (PortB in my example) needs to be treated as 2 independent halves.
So, if i'm updating either nibble with new data, i cannot allow it to overwitre the other nibbles contents on the port.

Maybe a few people will find this handy (once fully solved), i hope it helps.


Thanx in advance.
Marty.