I'm not sure of how the binary bits are assigned to registeres when written different ways.
- I know I can change bit 4 of TRISA by writing: TRISA.4 = 1
- I know I can set all bits of an 8 bit register to 1 by writing: TRISC = %11111111
But I don't know what order those numbers corespond to the registers. For example:
TRISC = %01111111
Does that set bit 0 or bit 8 to "0"?
And what about the many registeres that don't have all their values - a register that has bits I can set for bits 0-2, but I can't set 3, but I can set bit 4 and 5, and I can't set bit 7 and 8.
Does that mean I just omit those out of the placement in my string? For example:
PCON = %11000
... where each position in the string automatically falls into the bits I can change, or do I still need to fill all the didgets with some value, even if that place in the string represents a bit I cannot change (it's a grey box with a dash in the data sheet).
My confusion on this has lead me to writing all my programs like:
PCON.0 = 1
PCON.1 = 0
PCON.4 = 0
PCON.5 = 1
... I'd like to save some space and say:
PCON = %1001 or...
PCON = %10000100 or....
PCON = %00100001 (the above reversed)
..... but I don't know how the various positions assign to the various bits.
And to expand on that .... how would I assign just a few bits without changing the others? What if I wanted to assign "1111" to bits 2,3,4,5 without effecting bits 0,1 and 6,7? I've seen stuff like "$0f" in this context which I assume refers to the hex assignement of something, but again, no luck finding a consise primer or tutorial on this stuff.
I get what hex and binary numbering shemese are - lots of refrences for those, but none that show how to actually syntax it in PBP.
Can someone provide a good reference on this? I'm sure it's spelled out someplace but searching for "bit" "bitwise" "assembly bit assignment", etc on google turns up nothing.![]()
Bookmarks