Ok on to your Quetions:
The questions:
What is the best way to solve this problem?
If I forget about the OEM buttons, how do I get the GUI and the M3 and M4 scripts to work properly?
Would a Brain controller have the ability to solve this problem?
I run Modbus controlled machines alot, Are you running Modbus Directly into your VFD? If so, you need to look and see if you can do "Block addressing" of parameters that is the easiest. If your perameters cannot be User block addressed, then you will have to look at the parameters you do want to access and Read and/or Write to.
Other way, is easier (but a little more expensive), Have Mach talk to a PLC and let the PLC talk to your VFD.... The PLC has much more sofisticated Modbus capability, and you can talk to your Servo Drive to if you have them.
Anyway on to the show:
1).Goto Ports and Pins>Spindle, "UNTICK" the use 64 and modbus spindle!!!! (Unless your using Peters Modbus board). Tick off, step and direction for you spindle and enable/use the spindle tick.
2). for G-Code Driven M3, M4, M5, M7, M8, M9 to work, you HAVE to use Relays OUTPUTs 1-6 (there are other ways but they are more complex). This will allow G-Code and MDI to control the above functions and it will show on your GUI.
3). In ports and Pins, You will need to ENABLE your Spindle!!! SET ANY Spindle, Inputs, outputs that you plan to use you HAVE to Enable them!! Set the Port # to 3 (three) This is a non-existant Port, but that is OK, we are gonna control this stuff by Brains anyway!!!
4). Your Spindle speed control (in Brians), will Be DRO(99) (the Spindle speed percent DRO), The percent goes from 0-1, so you will need to Multiply this number By 100 and then Multiply that Total by the resolution of your Analog Card in your PLC or the Bit resolution of the speed control of your controller. I.e. I use Automation Direct PLC with a 12 bit analog Card that drives my Spindle. The resolution of that Card is 12 bits, so 4095. (I have attached a Brain for you that shows the Spindle control, and how to Use the status of your M3/4 Leds to reset your Spindle Speed Percent.......
5). Mach does have Enables they are called Enable 1-6, these bits only go Hot once Mach is up, you can send one of them, (your choice), out to your Spindle. You can also add a button that can toggle that Enable on and Off, (or put the code in an existing spindle button).
6). Brains...................... Brains is the ONLY way to go (Make sure you are using "Use Plug in Serial" in the Ports and Pins, and also in your modbus for brains. (Unless you are using Ethernet and that is very simular).
So in summery:
Set your M3 to OUTPUT1, M4 to OUTPUT2, (coolent to whatever), on the Spindle tab of Ports and pins. make sure the Disable Relays are UNticked.
turn OFF use Modbus Spindle (this is for Peters board), Tick On use Spindle Motor output and set it to Step and dir
Enable ANY Input/Output, or what ever you plan to use across the modbus, set the port to port 3. (Brains only looks at the function).
Enable your Spindle in motor control, set to port 3, pins are irrelevent.
Enable any Enables you wish to use for you various drives or functions that need an enable.
Make sure you have ticked: Modbus InputOutput Support, AND, Modbus Plugin Supported!! if they are not, tick them and reboot mach.
Under Setup Serial Modbus control:
I recommend using config 0 for your input stuff, and config 1 for your out put stuff
Make sure you Port #, Baud Rate, Protocol match the device your talking to, NOTE: Mach ONLY does 8-2-N, RTU Modbus
You will need to translate the Octal, or Hex address of your External device that you are talking to, to its decimal equivelent, put a start address and how many of the 16 bit registers you are bringin in, or going out to. (Note Currenlty Bit of Word is Broken, in Brains so if your device will only take a bit of Word type of control then you will need to go through a PLC to translate it.
READ your docs, Most stuff like PLCs, and VFD's will let you do Input Holding, and Output Holding, and drop those controls into User(Variable memory), or User Assigned parameter blocks......
Test your Modbus Connection here for Input and Output to your device......., if all is good, hit Apply, and OK, (Make sure the tick box for Modbus Run is ticked, and make sure NOT to forget to tick your Configs you will enable, and make sure the configs are also set to the port you are using!!!!
In Brains (I highly, highly, highly recommend you watch the Brians vidio tutorials). I am attaching a Working Spidle speed control Brian only, for ADC analog Card, but you can adapt it to your needs.
NOTE: INPUTS and OUTPUTs are TWO seperate things in Brains, so be careful since the Nomenclature is the SAME i.e. Modbus0 is the same for input and output as far as the name goes, you only differentiat it by ticking Input or Output when setting up the Ladder Rung.
see attached Brain.........
Scott