I haven't had the classical way of learning avr and as such I may have missed some beginner course that explained this, and I've honestly beat myself up over whether I should post this or not. However I am stuck. I need help.
I have been given an atmega2560 and a breadboard with 3 LEDs plugged in. I need to light them up in sequence as part of a much larger task but I am stuck on this tiny baby step. I believe I have a fundamental misunderstanding of ports but my google-fu and research has confused me further.
Here are my assumptions (I call it assumptions because I am not sure if I am correct on any of this):
This is the atmega 2560 datasheet: http://www.atmel.com/Images/Atme...
I believe that the relevant diagram that lists the ports is on page 2 but I don't know how that abstraction connects to the actual atmega 2560 (i.e. they look different). The most detailed pinout diagram I could find for the atmega2560 is http://www.instructables.com/fil...
In order to light up each LED, I need to target each specific port that they are connected to and set a PORTxn |= (1 << PBx) or something to that effect?
However in my research I found tutorials like this that explain how to interface with LEDs, however they don't really explain WHY PORTC is where the LEDs are connected. What is the normal way of lighting up an LED?
I realise that I simply don't know how to read the data sheet but my efforts in learning how to have come up short. I hope I've described my problem in detail and demonstrated my efforts to solve it.