Pin out of code

Hi all

Ok Im trying to run grbl on my Uno using H bridges, they say

The pin definitions can be adjusted in stepper.c

So I think this is the part of the code:

#define DIR_FORWARD 	(0)
#define DIR_BACKWARD	(1)

#define STEPPER_X_A1 	(0x01<<PINB0)	
#define STEPPER_X_A2 	(0x01<<PINB1)	
#define STEPPER_X_B1 	(0x01<<PINB2)	
#define STEPPER_X_B2 	(0x01<<PINB3)	

#define STEPPER_Y_A1 	(0x01<<PIND4)	
#define STEPPER_Y_A2 	(0x01<<PIND5)	
#define STEPPER_Y_B1 	(0x01<<PIND6)	
#define STEPPER_Y_B2 	(0x01<<PIND7)

#define STEPPER_Z_A1 	(0x01<<PINC0)	
#define STEPPER_Z_A2 	(0x01<<PINC1)	
#define STEPPER_Z_B1 	(0x01<<PINC2)	
#define STEPPER_Z_B2 	(0x01<<PINC3)

#define STEPPING_PORT_Z		PORTC
#define STEPPING_PORT_Y		PORTD
#define STEPPING_PORT_X		PORTB

#define STEPPING_DDR_Z		DDRC
#define STEPPING_DDR_Y		DDRD
#define STEPPING_DDR_X		DDRB

But im still not sure what pins I must use?

Ive attached the whole c file just incase.

Thanks…

stepper.c (20 KB)

Which pins you use depends on how you wired the H-bridges.

Yes but the code defines the pins does it not and I dont know what pins its setup to use.

I imagine that PINB0 means the I/O pin at position 0 in Port B. Look at the Arduino Uno pin mapping diagram

If they are not defined in stepper.c the values for PINB0 etc will de defined in some other file.

...R

You imagine? You don't have to imagine, it's right there in iom328p.h!

They're using direct port manipulation. Take a look at any good pinout diagram, and you'll see pins marked as things like B0, B1, B2, etc. There they're using 4 pins each from ports B, C and D.

Thanks all got it.

DrAzzy: You imagine? You don't have to imagine, it's right there in iom328p.h!

I was too lazy to do more than imagine

...R