Microcontroller output configuration
If I understand correctly if "Output control" block produces adequate positive voltage then p-mos if off and output pin in n-mos drain - pin pulled to ground. Is it correct?
  


Correct.


To give a high output P-MOS will be on and N-MOS will be off.
To give a low voltage P-MOS will be off and N-MOS will be on.



  
  How is the above scenario (n-mos active) different then Open drain which for me can only be realized in the same way by n-mos?
  


For a low output there is no difference. For a high output open drain voltage depends only on the external components.


  
  Is there any other advantage of this push-pull configuration than just the possibility of having output pulled to low/high.
  


Yes. Having an active push-pull is very useful for many reasons. Here are two:


The open-drain configuration cannot drive a load connected to ground.








simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Circuit (a) output will fall quickly as C1 discharges via M1 but may charge slowly depending on the time-constant of R1C1. Circuit (b) will rise and fall at close to the same rate and only limited by the internal resistance of the FETs.


The push-pull arrangement is much better for driving capacitive loads such as a MOSFET device. Driving high and low will charge / discharge the gate capacitance much more quickly and provide rapid switching with low power dissipation in the MOSFET.



  
  I've been told that in push-pull the current flow is different then it is in case of open drain but I really don't see it. In Push pull current can flow either from Vdd to PIN or from PIN to Vss. In open drain only from PIN to Vss. So it looks like no difference but that person suggested that one configuration allows internal current flow while other external. Does it really?
  


Push-pull can source and sink current. This is useful for the reasons explained in 3 above.


  
  I see that PIN is protected by diodes. So if I put higher voltage then Vdd or lower than Vss it will be shorted immediately. Is it correct?
  


The diodes provide limited protection to current-limited over / under-voltage on the GPIOs - particularly when used as inputs. The diodes will have a limited current handling capability. The current is diverted to the power rails and if there is nothing there to consume the power then the power supply voltage may increase to the point of damaging the chip.



Figure 2. The protection diodes on most logic chips creates a sneak-path to positive supply. This will keep the PNP transistor permanently turned on and may damage the chip. Source: GPIO high-side driver fail.

The diodes can provide unexpected problems to designers with limited experience as shown in Figure 2.


  
  What is the point of Schmitt trigger for input here?
  


The Schmitt trigger provides well defined high and low switching points with hysteresis between them. In general, the input voltage will have to rise to 2/3 supply to register a '1' and fall to 1/3 supply to register a '0'. This is usually better than switching at 1/2 supply because chatter will result if the input voltage is just on the threshold.