Stirling
I see you seem to have some experience with Modbus and arduino in Mach3 and since I am struggling to get any answers here on the forum I thought I'd ask you directly.
Using the Arduino mega 2560 I have serious amounts of pins that I can use, however I have an LCDKeypad shield that plugs onto the headers of the mega and virtually leaves me with the pin header containing 22-53 to use for my stepper drivers (step and dir)
The specs of the DIY cnc Mill I have built is somewhere here on the forum but I could post it here if it would have any bearing on the issue I am struggling with.
What I am struggling with is confirming if I define the motor outputs in the Mach config "ports and pins/motor outputs" to say X step = 22, X dir = 23, Y step = 24, Y dir= 25 etc etc would I be able to get the motors running. The Modbus I am using is the one on the forum by a guys called Schilling and defines registers as follow:
//############ REGISTER DEFINES ############# // Each Register is 16bit
#define Digital_IO_Register 0
#define PWM_Register 10
#define AN_Register 30
#define Timer_Register 50
#define IO_Config_Register 60
#define Kill_IO_Register 70
#define PWMIOMap_Register 80
#define ANIOMap_Register 81
#define General_Config 90
#define Error_Register 91
#define Digital_IO_Pins 64 //Total number of Digital IO pins, Limits update scanner pin count
#define Number_Of_Registers 100
//############ GLOBAL VARIABLES ##############
unsigned char Data[256]; // All received data ends up in here, also used as output buffer
unsigned short Index = 0; // Current Location in Data
unsigned short Register[Number_Of_Registers]; // Where all user data, Coils/Registers are kept
ModBusSlave ModBus(Slave_Address,Register,Number_Of_Registers); // Initialize a new ModBus Slave, Again, you must have my Arduino ModBusSlave Library
unsigned long Last_Time=0;
unsigned long Time = 0;
unsigned long LongBreakTime; //Time for 3.5 characters to be RX
//################## Setup ###################
// Takes: Nothing
// Returns: Nothing
// Effect: Opens Serial port 1 at defined Baudrate
// Configures all Pins
// Initiallized Timer 1
void setup()
{
//################ Initialize IO ################# // 0 => Output, 1 => Input, opposite of normal Arduino, but my habit from other platforms, 0 looks like an O and 1 looks like an I
Register[IO_Config_Register] = 0b0000000000000000; // UNO and MEGA PIN 00-15
Register[IO_Config_Register+1] = 0b0000000000000000; // MEGA PIN 16-31
Register[IO_Config_Register+2] = 0b0000000000000000; // MEGA PIN 32-47
Register[IO_Config_Register+3] = 0b0000000000000000; // MEGA PIN 48-64
Register[IO_Config_Register+4] = 0b1111111111111111; // AN Digital PIN A0-A16
//################ Kill IO Register ################# // 0 => Leave, 1 => Kill
Register[Kill_IO_Register] = 0b1111111111111111; // UNO and MEGA PIN 00-15
Register[Kill_IO_Register+1] = 0b1111111111111111; // MEGA PIN 16-31
Register[Kill_IO_Register+2] = 0b1111111111111111; // MEGA PIN 32-47
Register[Kill_IO_Register+3] = 0b1111111111111111; // MEGA PIN 48-64
Register[Kill_IO_Register+4] = 0b1111111111111111; // AN Digital PIN A0-A16
//################ PWM IO Register ################# // 0 => Normal I/O, 1 => PWM I/O
Register[PWMIOMap_Register] = 0b0000111001101000; // UNO and MEGA PWM 01-16
//################ AN IO Register ################# // 0 => Digital, 1=> Analog
Register[ANIOMap_Register] = 0b1111111111111111; // UNO and MEGA
Config_IO();
Thanx in advance for any help.