1

I'm currently looking at my Arduino MEGA 2560 board and was just wondering why there are different ports to it e.g. ANALOG IN, DIGITAL, Communication? in fact I've only seen this in some microcontrollers. Not many microcontrollers have ports dedicated to certain things. Is anyone able to give me an answer as to why there is different ports to the microcontroller? is it making it easier for the chip to handle etc. A detailed but not too detailed answer would be great!

| improve this question | | | | |
  • 1
    "Not many microcontrollers have ports dedicated to certain things." [citation needed] – Ignacio Vazquez-Abrams Oct 14 '14 at 20:18
  • I remember using an Attiny chip, not sure of the exact model, which basically just had ports A,B,C,D and didn't have any labels such as PORT A = Write PORT B = Communication etc. Basically from my experience, what I think is i've seen is that Not many microcontrollers seem to have dedicated ports to them – Zer0 Oct 14 '14 at 20:21
  • Most ATtiny MCUs do have peripherals fixed to specific pins. The ATtinyX41 have reassignable pins for OC, but they're also fairly new. – Ignacio Vazquez-Abrams Oct 14 '14 at 20:27
  • 1
    Probably because it means less logic which means less upfront development cost which means lower cost to the system integrator. – Ignacio Vazquez-Abrams Oct 14 '14 at 20:29
  • 1
    Most microcontrollers have a lot of pins with various functions, but extremely complex patterns of what is and isn't supported on each pin, often appearing to derive from internal details known only to the designers. In short, you look at the data sheet with care, but don't (productively) wonder why. A great way to shoot yourself in the foot (if you neglect to check) is to design a PCB connecting a signal to a "general purpose" pin which happens to uniquely not support the one special mode you actually need it for... – Chris Stratton Oct 15 '14 at 4:24
-1

Thats because Arduino has configured the Mega to do so. In microcontrollers you need to select what use will each pin have based on the availability. To make user interface easy arduino has done this based on what is commonly used by everyone. Even then some functions are still not disabled.

For example 50,51,52,53 are SPI pins on mega which use Pin change interrupt for working. Thus it not necessary we use them for SPI we can also use them for Pin change interrupt.

Similar is the case for pins 10,11,12,13. These PWM pins can also be used for Pin change interrupt but other PWM pins cannot.

| improve this answer | | | | |
  • This is not correct! On most atmega, attiny, some pins can serve a specific purpose (eg usart, spi, i2c, analog input) and although you can use them for digital input or output, you cannot chose other pins for these specific purposes. Hence, this is not "Arduino that configured the mega". – jfpoilpret Oct 15 '14 at 6:21
  • Well if you can look at the data sheet of atmega 2560 used on the mega you can see a lot of functions for a single pin. and also There are some pins having pin change interrupts on them but they do not work on the mega board. I have seen working of ARM cortex-M4 microcontroller, many functions exist on each pin and you need to have a board configuration file programmed to enable disable some the pins of registers and ultimately the functions. A similar version exists at the ATmega controllers if you can see the proper programming in CVAVR. – Karthik Satya Sai Korada Oct 15 '14 at 6:31

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.