Search code examples
picpic18

PIC programming which bits are which in TRIS register


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?


Solution

  • 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.