Mega 2560 Ports

I used a Nano classic because it exposed A0-A7, of which I used A0-A6 to write 7 bits to the port simultaneously. Some of you might already see the issue. A6 and A7 do not work as digital outputs with the 328P. So far as I see there is no way to write 7 or 8 bits to a single port as a digital output on any port on the 328P.

To that end, I upgraded the project to a Mega 2560. Looking at the pin/port diagram for the Mega 2650, it looks like I can easily use Port F or Port K to write 7 or 8 bits as a digital output. Do I have that correct or is there a pitfall that I've missed?

There are several more ports on the header at the bottom that are not listed in your diagram.

Here is a list I got from the pins_arduino.h file, sorted by port. All eight pins are available on ports A, B, C, F, K, and L.

//Port ** Arduino Pin Number ** pin designation
PA 0 ** 22 ** D22	
PA 1 ** 23 ** D23	
PA 2 ** 24 ** D24	
PA 3 ** 25 ** D25	
PA 4 ** 26 ** D26	
PA 5 ** 27 ** D27	
PA 6 ** 28 ** D28	
PA 7 ** 29 ** D29	

PB 0 ** 53 ** SPI_SS	
PB 1 ** 52 ** SPI_SCK	
PB 2 ** 51 ** SPI_MOSI	
PB 3 ** 50 ** SPI_MISO	
PB 4 ** 10 ** PWM10	
PB 5 ** 11 ** PWM11	
PB 6 ** 12 ** PWM12	
PB 7 ** 13 ** PWM13	

PC 0 ** 37 ** D37	
PC 1 ** 36 ** D36	
PC 2 ** 35 ** D35	
PC 3 ** 34 ** D34	
PC 4 ** 33 ** D33	
PC 5 ** 32 ** D32	
PC 6 ** 31 ** D31	
PC 7 ** 30 ** D30	

PD 0 ** 21 ** I2C_SCL	
PD 1 ** 20 ** I2C_SDA	
PD 2 ** 19 ** USART1_RX	
PD 3 ** 18 ** USART1_TX	
PD 7 ** 38 ** D38	

PE 0 ** 0 ** USART0_RX	
PE 1 ** 1 ** USART0_TX	
PE 3 ** 5 ** PWM5	
PE 4 ** 2 ** PWM2	
PE 5 ** 3 ** PWM3	

PF 0 ** 54 ** A0	
PF 1 ** 55 ** A1	
PF 2 ** 56 ** A2	
PF 3 ** 57 ** A3	
PF 4 ** 58 ** A4	
PF 5 ** 59 ** A5	
PF 6 ** 60 ** A6	
PF 7 ** 61 ** A7	

PG 0 ** 41 ** D41	
PG 1 ** 40 ** D40	
PG 2 ** 39 ** D39	
PG 5 ** 4 ** PWM4	

PH 0 ** 17 ** USART2_RX	
PH 1 ** 16 ** USART2_TX	
PH 3 ** 6 ** PWM6	
PH 4 ** 7 ** PWM7	
PH 5 ** 8 ** PWM8	
PH 6 ** 9 ** PWM9	

PJ 0 ** 15 ** USART3_RX	
PJ 1 ** 14 ** USART3_TX	

PK 0 ** 62 ** A8	
PK 1 ** 63 ** A9	
PK 2 ** 64 ** A10	
PK 3 ** 65 ** A11	
PK 4 ** 66 ** A12	
PK 5 ** 67 ** A13	
PK 6 ** 68 ** A14	
PK 7 ** 69 ** A15	

PL 0 ** 49 ** D49	
PL 1 ** 48 ** D48	
PL 2 ** 47 ** D47	
PL 3 ** 46 ** D46	
PL 4 ** 45 ** D45	
PL 5 ** 44 ** D44	
PL 6 ** 43 ** D43	
PL 7 ** 42 ** D42	
1 Like

Works for me. Thanks for taking the time to answer.

Happy New Year!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.