Welcome! Log In Create A New Profile

Advanced

Problem understanding Pins.h

Posted by Don Recardo 
Problem understanding Pins.h
April 04, 2015 01:00PM
Hi
I am still waiting for my Ramps 1.4 board to arrive from China but trying to get to grips with ramps while I am waiting

I looked at the PCB for the ramps board in Eagle and the step pin on the X axis driver seems to connect to the arduino Mega 2560s Analog zero pin which according to the arduino pin mapping sheet
is pin 97

Now according to Pins.h the X step pin is defined as pin 54 not 97 .
looking at what pin 54 is on the pin mapping sheet it says its digital pin 36 which looking at the pcb in eagle should be connected to the step pin on E1 driver not the step pin on the X axis driver

I'm confused ????

When pins.h says X axis step pin is defined as pin 54 is that pin 54 on the MCU chip or is it one of the pins named 54
around the edge of the PCB and if so where is it because mine are only marked as high as 53

Don
Re: Problem understanding Pins.h
April 04, 2015 03:15PM
The analog pins on the Mega A0-A15 are internally represented by the arduino pin numbers 54 to 69. These plain numbers can also be used when referring to those pins as digital pins. Thus, arduino pin 54 is actually the same as A0, which in turn corresponds to the physical pin 97.
Re: Problem understanding Pins.h
April 04, 2015 03:55PM
Quote
enif
The analog pins on the Mega A0-A15 are internally represented by the arduino pin numbers 54 to 69. These plain numbers can also be used when referring to those pins as digital pins. Thus, arduino pin 54 is actually the same as A0, which in turn corresponds to the physical pin 97.

Thanks for the reply

Do you know of a table anywhere that shows the correlation between arduino pin number / name and physical pin number ?

Don
Re: Problem understanding Pins.h
April 04, 2015 04:47PM
I haven't found any official documentation that explains the correspondence between analog pins A0 - A15 and digital pins 54 - 69. But if you look at the arduino source code, you'll find in file arduino/hardware/arduino/variants/mega/pins_arduino.h the following code where this correspondence is implemented:
static const uint8_t A0 = 54;
static const uint8_t A1 = 55;
static const uint8_t A2 = 56;
static const uint8_t A3 = 57;
static const uint8_t A4 = 58;
static const uint8_t A5 = 59;
static const uint8_t A6 = 60;
static const uint8_t A7 = 61;
static const uint8_t A8 = 62;
static const uint8_t A9 = 63;
static const uint8_t A10 = 64;
static const uint8_t A11 = 65;
static const uint8_t A12 = 66;
static const uint8_t A13 = 67;
static const uint8_t A14 = 68;
static const uint8_t A15 = 69;
Re: Problem understanding Pins.h
April 04, 2015 05:20PM
Thanks for your help I had began to think I was going mad but its making sense now

Don
Sorry, only registered users may post in this forum.

Click here to login