Hello Guest it is February 20, 2024, 10:56:21 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - lenitech

Pages: 1
Mach4 General Discussion / Re: Modbus Spindle PLC script
« on: December 04, 2023, 03:35:28 AM »
This worked!


Mach4 General Discussion / Re: Modbus Spindle PLC script
« on: December 04, 2023, 01:27:16 AM »
I have now tried this as well but it doesn't work either:

freq = mc.mcCntlGetPoundVar(inst, mc.MC_SPINDLE_RPM)

Mach4 General Discussion / Modbus Spindle PLC script
« on: December 04, 2023, 01:05:42 AM »
I'm a long time Mach3 user and I'm finally trying to see if I should upgrade to Mach4.  I have it mostly working except for the controlling spindle speed via VFD.  I have read through lots of forum posts and the lua guide but still can't get it to work.  I used the instructions from user "giddyup" for my Automation Direct GS2 VFD located here:  https://www.machsupport.com/forum/index.php?topic=34023.60 and it mostly works.

I do know that my modbus registers are working because I can turn the spindle on and off using M3, M4, and M5.  I also know that I can send the speed to the VFD because I see the modbus register update using the diagnostics window when using the script below.  Below is the PLC script that works to set a single spindle speed of 60Hz.  How can I pull the spindle RPM from the spindle DRO or the mach4 system variable mc.MC_SPINDLE_RPM and put into my freq variable below?:

freq = 60x10
hfreq = mc.mcRegGetHandle(inst,"modbus0/speed0")

Below are things I have tried to get the current set spindle speed:
freq = mc.MC_SPINDLE_RPM
freq = scr.GetProperty("Spindle RPM", "Value")
freq = mc.mcCntlGetPoundVar(inst,2132)

Also, one thing I have noticed is that using mc.mcCntlGetPoundVar(inst,2132) seems to write a 0 into my modbus speed0 register because it overwrites manually inputted values.  It seems like maybe the default spindle speed it is reading is 0 rather than the value displayed in the DRO.

Modbus / Re: Modbus and GS-2 Spindle help
« on: July 30, 2014, 02:53:51 AM »
Ok, I got this all sorted out.  If you make your own RJ12 to DB9 connector you need to make a straight thru connection.  This isn't clear in the Automation Direct manual because it shows RXD going to TXD which would be a crossover cable.  The pin connections are as follows:

RJ12                DB9
2 Ground    ->  5  Ground
3 RXD        ->  2  RXD
4 TXD        ->  3  TXD

Also, 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.  So for the GS2 you have only 3 options: 8-N-2, 8-E-1, or 8-O-1.  I set mine up for 8-O-1.

Make sure to set you slave address in the GS2 and Modbus Serial setup to the same number.  Set your base RPM and max RPM in the GS2 as well.

The attached images have all of my settings.  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.  Also, don't forget to set the pulley 1 max and min speed under "Config->Spindle Pulleys.."

Copy and paste the scripts from this post http://www.cnczone.com/forums/mach-mill/27820-modbus-run-gs-2-drive-2.html into your mach3 macros folder.

I spent more time than I should have figuring this all out.  It only takes 5 minutes once you know what you are doing.

Modbus / Re: Modbus and GS-2 Spindle help
« on: July 21, 2014, 02:55:36 AM »
It seems that a few people have already gotten the GS2 VFD set up and running with Mach3 using Modbus Serial.  Can one of you kindly post the settings in Mach3 so that others can get it set up also.  It is not clear to me what has to be done and the few topics posted seem to use the wrong Modbus decimal address's based on the automation direct GS2 manual.  Also, is the RJ12 to DB9 cable a crossover cable or straight through.  I have been pulling my hair out trying to get mach3 to communicate with this drive.  I have set the baud rate, parity, and stop bits in the VFD, PC device manager, and Mach3.  Nothing seems to work.

Pages: 1