PINs on the UNO is what pin on the Mega2560

Dear forum

I have found a app for a frequency counter using a UNO, I myselve have a AtMega 2560.

Where can I find a pin mapping table for UNO and AtMega2560, so I can find out what pin on the UNO is on the Mega.

Can you please help a novice.

thanks

The standard Arduino pin numbers - for example digitalRead(5) or analogRead(A0) are designed to work on all the Arduinos.

...R

Search for uno pin map and search for mega pin map and compare.

The following might/will be different SPI pins of the mega are not on pins 10..13 I2C pins on the mega are not available on A4/A5.

dear Forum thanks for your answers

I did look at the pin out of Mega, but I dont find a PD5 and a PD6 as required for this app: https://circuitdigest.com/fullimage?i=circuitdiagram_mic/frequency-counter-using-arduino-circuit-diagram.png

can you help?

regards

seaimager: I dont find a PD5 and a PD6 as required for this app

Why would an app use those numbers (which afaik are the chip's) not the 0-1-2 etc numbers which relate to the Arduino. PD5 and PD6 are just Arduino 5 and 6 according to that diagram, and although I don't know where to go on that site to see the code, are surely the numbers used in the code.

I dont know exactly what you mean, PD0, PD1 etc. exist but no PD5 and 6. The pins are used for the lcd display for data O - 3
its frequency counter for Arduino on tha site.

seaimager: PD0, PD1 etc. exist

Every Uno I've ever seen, and all the pix, show the pins numbered 0, 1, 2 etc not PD0, PD1 etc

ATmega2560-Arduino Pin Mapping

I suggest that you post the code so we can see what's going on.

I see that you managed the url in your first post correctly; but just in case, please read How to use this forum - please read, specifically point #7 about posting code before you post the code.

I have found a app for a frequency counter using a UNO, I myselve have a AtMega 2560.

Please post the code used with the circuit diagram provided.

The issue that I see is not with the lcd pins used, but rather the Schmitt trigger connected to pin8. This is the input capture pin for Timer1, and it's possible that the frequency counter code is using the ICP pin for Timer1.

That pin is not broken out on a Mega, and the code needs to be changed to use Timer4 or 5 which have ICP pins broken out on digital pins 49 and 48.

The lcd can be hooked up to any pins specified in its "constructor", and migrating to a Mega is pretty straightforward.

Thats all the information I have:

https://circuitdigest.com/microcontroller-projects/arduino-frequency-counter-circuit

thanks for help

regards

seaimager:
Thats all the information I have:

Arduino Frequency Counter Tutorial with Circuit Diagrams & Code

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

int Htime;              //integer for storing high time
int Ltime;                //integer for storing low time
float Ttime;            // integer for storing total time of a cycle
float frequency;        //storing frequency

void setup()
{
    pinMode(8,INPUT);
    lcd.begin(16, 2);
}
void loop()
{
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Frequency of signal");

    Htime=pulseIn(8,HIGH);      //read high time
    Ltime=pulseIn(8,LOW);        //read low time
    
    Ttime = Htime+Ltime;

    frequency=1000000/Ttime;    //getting frequency with Ttime is in Micro seconds
    lcd.setCursor(0,1);
    lcd.print(frequency);
    lcd.print(" Hz");
    delay(500);
}

It seems to me there are no portability issues (to a Mega) with that code.

Ah, so the PD5 and PD6 you are referring to are just the labels on the wiring diagram. Those are referring to the ports numbers in the UNO, but can be ignored in this case. Go by the numbers shown adjacent to the connections coming off the UNO, in this case 5 and 6, which are the numbers that are printed on the connectors of the UNO board. The mega will have the same pin labeling with the same numbers (the UNO and mega are designed so that a shield that plugs into an UNO will plug directly into a mega, so the pin arrangement on that section of the mega is for the most part the same as an UNO).

When asking questions on here, the code for an arduino is referred to as a sketch. When you mentioned an app, that gives people the impressing you are referring to a cell phone app that is being used to control the arduino.

Now its clear

Thank you all very much

regards