1
\$\begingroup\$

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?

\$\endgroup\$
  • 5
    \$\begingroup\$ It does not have PORT A. Do you mean PORT C? \$\endgroup\$ – Justme Aug 22 at 21:14
  • \$\begingroup\$ Yes, sorry I mean Port C \$\endgroup\$ – markvdlaan93 Aug 23 at 7:14
4
\$\begingroup\$

can I use port A as digital output pins without ruining the microcontroller?

Yes you can.

enter image description here

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. enter image description here

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. enter image description here

do I need to add additional configurations inside my C program?

Follow the normal routine as configuring other pins.

enter image description here

\$\endgroup\$
  • \$\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\$ – Jeroen3 Aug 23 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\$ – Umar Aug 23 at 10:34
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.