Atmega328p datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf
Input reads voltage on pin or current ?
Voltage. However, for digital inputs, it is only a binary reading:
- Voltage closer to VCC voltage value is treated as "high" input (a "1" in software)
- Voltage closer to Ground is treated as a "low" input (a "0" in software)
For the specific of "closer", you'll have to refer to the datasheet page 322 where you can find "Electrical Characteristics > DC Characteristics":
- VIH refers to the "high" input voltage reading
- VIL refers to the "low" input voltage reading
Any voltage in between VIL and VIH thresholds will retain its previous value in software until it crosses VIL or VIH one more time. This mechanism is commonly referred to as "Schmitt Trigger" mechanism, more on that here: http://www.ti.com/lit/an/scea046/scea046.pdf
Page 609 of the datasheet shows graphs for "Pin Threshold and Hysteresis". You can see that VIL and VIH vary with temperature and voltage and you'll find information about the "hysteresis" zone of the schmitt-trigger.
If it reads voltage, is it able to sink in current, in oher words act as a ground?
If it can act as a ground, is there any internal resistor that limits the current?
No, it is not able to sink current, inputs are high-impedance. It cannot act as a ground.
Datasheet page 323 shows you the "Input Leakage" current for both "low" and "high" states (IIL and IIH).
While in output mode, and I pull pin high it outputs current, while it is in low can it sink in current, in other words does it act as a ground pin when it is low?
The wording of "act as a ground pin" is a bit ambiguous. In one way, yes it is returning current into the ground path with very-low impedance so it can be considered ground at that moment. However, especially if you intend to use it as a permanent ground pin, be aware of the current limit called IOL (for "low" state).
The limits vary with output voltage and temperature and you can find graphs page 607 of the datasheet (in section "Pin Driver Strength").
In this section, you'll also find graphs for IOH which refers to the output current in a "high" state.
Make sure in your design to not exceed the IOL current values as you may well end up damaging your microcontroller pin. For that reason, it is not a "true" ground pin.
While in output mode does it have any internal resistor that will limit the current?
Most microcontrollers general-purpose outputs does not have current-limiting feature. In case you exceed the maximum output current for too long, the internal driver will fail and you won't be able to use this pin as an output anymore.
This is the case for the Atmega328p