Reputation: 941
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?
Upvotes: 2
Views: 136
Reputation: 11
After using TRISB &= 0b11100000
, RB5-RB7 will keep their state and RB0-RB4 will be cleared - set to outputs.
Usually clearing bits is done with TRISB &= ~(0b00011111)
for 'clarity'
Upvotes: 1
Reputation: 1775
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.
Upvotes: 0