Mach3 Serial Port Plugin Download
вторник 25 сентября admin 96
In a nutshell Mach3 uses the Local Printer Port to communicate with the TB6560 Driver board via a Parallel cable. Pins and Ports refers to the LPT 'Port' configured in Windows and and the actual signal. It is Port 1 (from LPT1) on the PC's serial/parallel bus. Further down is 'Resource type' and 'Setting' We need the first line that. Nov 23, 2017 - The parallel port is now obsolete so how can we still use Mach3 which required one to work a CNC. Just plug in the DB-25 cable and that's it.
I will describe here how to connect arduino directly to mach3 without any additional hardware. This will not use any modbus library it is just proof of working. You will end up with ability of mach3 to read input pin on arduino. But if this will work for you then adding full modbus library for proper comunications shouldnt be any problem.
Small think about modbus Modbus is software protocol not hardware, so you can use it not only ower rs232 or rs485 but also let say uart usart. Doesnt matter the amount of connections the hardware protocol uses, basicaly it boils down to one comunication line for half duplpex and two for full duplex. The comunication of mach3 with arduino will be done using uart.
So rx tx lines. In this case the standard Usb cable connecting pc and arduino will do. But you can buy USB to rs485 adapter and connect to rx tx lines and it should be basicaly the same think. On the image is the whole setup.
Arduino connected to PC + one led but you dont need the LED (it is just indicator so i know what information should be send back from arduino) and cable so you can ground a pin on arduino. Led should have resistor in series, i just coudnt be bothered and the led suvived.
On left side of image is the USB to rs485 adapter (you dont need that). I just wanted to add it in case you wanted to know what the one i have looks like. And it works fine. I was trying it with some rs485 hardware. I did my test with arduino mini pro.
This was the inspiration for my test and the code is from this page: First software for arduino: The whole think is very simle, arduino recives in this case any 8 bites and replies with 01 04 02 00 00 78 f0 or 01 04 02 00 01 b9 30 In real comunication these packets are modbus reply for '01 04 00 00 00 01 31 ca' question. Which is read input register question. So we will send request from mach3 to read input register and arduino replyes with data containing 1 or 0. So thisway we can read state of inputpin on arduino.
Quick look at the modbus package: let say thisone: 01 04 02 00 00 78 f0 • 01 is addres of slave device • 04 is information that we are going to read input register • 02 00 00 lets simplyfy this for the data information. ( but basicaly it is N*8bits of data in this case so 2 bit containing 00 00) • 78 f0 is just checksum so mach3 will read from thees returned packets 01 04 02 00 00 78 f0 returned ingormation is 0 and from 01 04 02 00 01 b9 30 returned ingormation is 1. Now we send request command to arduino 01 04 00 00 00 01 this is what mach3 will do. We could send any 8 bytes to arduino as you can see from program, it is just to properly answer so arduino doesnt care for question in this case.