I am trying to understand PIC18 code in a format like TRISB &= 0b11100000.
What is the order the individual RB pins appear in? i.e. is this register setting RB0-RB2 as input, or RB5-RB7 as input?
2 Answers
in the code TRISB &= 0b11100000, the binary value sets the direction of the lowest pins, RB0-RB2, as outputs, and the highest, RB5-RB7, as inputs.
2 Comments
Tagli
Actually, it doesn't touch RB5-RB7, it leaves them as they are. Because it's a
&=, not a = operation.Ali Safari
Indeed, it doesn't change the states of ` RB5-RB7
; it only clears bits RB0 to RB4 to make them outputs while leaving RB5-RB7` in their current states.