Port B is an input only port also functioning as an A/D converter analog input pin. Only 4 pins, PB0 to PB3, are available in the shrink-dip packaged part.
PIN | Alternate Function | |
PB0 | AN0 | |
PB1 | AN1 | |
PB2 | AN2 | |
PB3 | AN3 | |
PB4 | AN4 | |
PB5 | AN5 | |
PB6 | AN6 | |
PB4 | AN7 |
One register control its functions:
• Port data register B (PDRB)
PDRB simply holds the state of the pins on port B.
Using the header files provided with the GNUH8 toolchain, port B and its registers are found in the IO address space and can be accessed using statements like these:
unsigned char value; int data; data = IO.PDRB.BIT.B2; // read a single bit into an integer variable value = IO.PDRB.BYTE; // read an entire byte