I'm currently trying to connect a 7x5 dot matrix to an AVR ATMega328p. I'm already using port B/D and I would like to use port C so that I have extra output pins. My question is, can I use port C as digital output pins without ruining the microcontroller? I know that this port is normally used for analog-digital conversion. If so, do I need to add additional configurations inside my C program?
2 Answers
can I use port A as digital output pins without ruining the microcontroller?
Yes you can.
Below table describes about Sink and source capabilities:
VOH is when you try to output a high signal. The current should be less than a particular value which you can find in the same table. VOL is when you output a logic zero. Microcontroller can sink current and you should also care about limiting the current. Excess current may lead to damage of the IO Pin or the whole MCU.
Below are some notes about the analog function rich port C (in some packages, other ports) describing the GPIO capabilities and precautions to be taken.
do I need to add additional configurations inside my C program?
Follow the normal routine as configuring other pins.
-
\$\begingroup\$ It has been a while since I used this part, but I recall port C being supplied by AVCC instead of VCC for digital functions as well. \$\endgroup\$– Jeroen3Aug 23, 2019 at 8:41
-
\$\begingroup\$ When it is the case, if the user is notnusing analog function, He/She can connect Digital VCC to AVCC as well \$\endgroup\$ Aug 23, 2019 at 10:34
An analog pin is actually a normal pin with the alternate function of analog to digital conversion may be activated when needed, so you can use it as a digital pin in case if you don't activate ADC.