In AVR ATmega2560 microcontroller, there're 3 register for I/O port: DDxn, PORTxn, and PINxn
DDxn decide the direction of each pin while other two, according to the datasheet
PINxn toggle the value of PORTxn by written 1 into PINxn
If pin is input (DDxn is written 1), written 1 to PORTxn turn on pull-up resistor and written zero turn it off
- If pin is output (DDxn is written 0), port pin is driven high (one) if PORTxn is written 1 and low (zero) if PORTxn is written zero
I don't understand what these term means: pull-up resistor, driven high and low. What is the difference between 2 terms. What do they do with I/O port and what is the use of them? Can anybody give me explanation and example.
I also don't know what is register used for store address for I/O. I means for input and output there must be some address tell where input data is stored or address tell where data is ouput. Furthermore, if 8 pin of one port is configured to be mixed between output and input then how the data of each bit of each pin is organized to be store in a register (which contain 8 bit)