The board provides
32 terminals that are organized in to 4 groups, each having 8
terminals, namely A, B,C and D. The individual
terminals are marked as PA0 -- PA7 for port A, PB0 -- PB7 for port B
etc. They can be controlled/monitored as a group or as individual
pins. Each pin of the port can be configured as output or input, by
setting/clearing the corresponding bit in the Data Direction
Register. For complete details refer to the ATMega32
use the terminals PA0 to PA7, you need to access the registers
DDRA, PORTA and PINA. Each pin can be made to act as an input or
DDRA : Data direction register. Writing a 1 to any bit makes the corresponding pin an output. For example setReg(DDRA, 255) makes all the pins as output.
PORTA: This is the data for the pins configured as outputs. Writing a 1 to a bit makes the corresponding pin HIGH. For pins configured as inputs writing a 1 connects the pin to the supply through an internal 10k resistor.
PINA: This is for reading the status of the input pins. data = getReg(PINA) gets you the status of voltage levels present on PA0 to PA7
The other ports can be used in a similar manner.