lpoanime.blogg.se

Setup serial modbus mach3
Setup serial modbus mach3










setup serial modbus mach3

Mb.addHreg(2) //Holds 0.XXXX value for X axisĭro_tbl(refresh) // Send Refresh screen to dro_tbl Mb.addHreg(1) //Holds X.0000 Value for X axis Mb.addHreg(0) // used for the X Axis +/- sign for X axis Mb.setSlaveId(slaveid) //Holds slve address Int16_t hreg // Hold the Modbus 4000 registersīyte refresh = 1 //Used to refersh the display #define slaveid 1 // Set the Slave ID (1-247) LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE) // Set the LCD I2C address This is the code I'm using not sure what's or where I'm going wrong /* MODBUS DIGITAL READ OUT */ What's happening when I view the brain I can see that the reading is 2.2650 and Int(A) =2.0000 and then this formula (A-B)*10000) = 2650.0000 that is been sent looking at the picture below but when I print this on my LCD the value is showing 2.2649 ?Įven if I print the xc & xc1 value still showing on the LCD is xc=2(correct) and xc1=2649 and not 2650 like it is in the brain I've got it working (just on the X Axis at the moment) but I'm either not creating the brain correctly or the conversion is not right and hopefully some one on here may a bit more of a clue than me. It only takes 5 minutes once you know what you are doing.I've been working on a small project, To make a remote DRO for MAch3 using Modbus. I spent more time than I should have figuring this all out. Also, don't forget to set the pulley 1 max and min speed under "Config->Spindle Pulleys."Ĭopy and paste the scripts from this post into your mach3 macros folder.

setup serial modbus mach3

My spindle now runs M3 FWD, M4 Reverse, M5 stop, and speed control 80-6000 RPM with the variable drive pulley set at 3000 on the Bridgeport. The attached images have all of my settings. Set your base RPM and max RPM in the GS2 as well. Make sure to set you slave address in the GS2 and Modbus Serial setup to the same number. So for the GS2 you have only 3 options: 8-N-2, 8-E-1, or 8-O-1. The pin connections are as follows:Īlso, you need to set the communication protocol in the GS2, Mach3, and the COM port under windows device settings to be the same and they must be RTU. This isn't clear in the Automation Direct manual because it shows RXD going to TXD which would be a crossover cable. If you make your own RJ12 to DB9 connector you need to make a straight thru connection.












Setup serial modbus mach3