Peter if there is anything that I can do to help with the Mach3 side of it I am here 
Hi Brian,
Thanks for the offer. At the moment things are OK. I am usingthe same Modbus interface I used on the Mazak Lathe Toolchanger. John Prentice wrote the MacroPump script for that, and it should work for the Emco toolchanger module as well. There might also be some info on it in the Wiki.
I have included the Register set used for the toolchanger with a brief description of their use. Effectively, you just set the new tool number in a register, change the value in the 'Count' register to initiate the change. Another input register is monitored until it's value is the same as the output count register's value. When the values are the same the toolchange has completed. Then check the status register incase there was a problem with the change.
There is also a "current tool" register that can be read to find out what the cureent tool position is in the changer. Anyway, have a look at the include below.
BTW, it would be good if we could come up with a "Standard" toolchanger interfave for Mach3. It would make things easier in the future.
Cheers,
Peter.
********************************************************************************
The ModIO will read the 2 optical switches and drive the Motor direction Relay.
I presume when the relay is off, it is driving the motor in reverse to lock the
turret.
Also do you have an indicative measure of the time it take the Turret to rotate
360 degrees.
I need to know this for safety time-outs .
The EMCO changer has 2 inputs, a turret home switch and a Turret position
switch. The home switch indicates that the turret is lined up with tool position
one locked. This switch will activate whenever the turret passes position 1.
The other switch the turret position switch input is the input from 6 turret
position switches in parallel. If any one of the 6 switches are activate then
this input will be active. Therefore, this input doesn't indicate what tool
position we are at, just that the "Next" tool position has been reached. There it
is necessary to keep track of where the changer is relative to the home
position (Tool 1)
The changer will work as follows;
On startup or after an error occurs we assume we are lost. When the first
toolchange request comes in, the changer will rotate until it sees the home
switch input go active. When it sees this it knows where it is, tool 1, and can
then move to the requested position.
There is also a timeout. If the home switch is not found within the configurable
timeout, an error is assumed to have occured, and the changer stops.
When a tool change is requested and the current position is known, the changer
rotates the turret counting the number of times the position input goes active
until the desired tool position is reached.
There are also 6 outputs used as position indicators, plus a status indicator
output. The position indicators will illuminate when the turret is at the
indicators position. That is, indicator 2 will illuminate when tool position 2
is reached.
The status indicator will illuminate whenever the tool changer is activated.
It will extinguish when the change operation has completed. If an error has
occured and the change is aborted, the indicator will flash until the next
valid operation has completed.
Once the desired position is reached, the motor forward relay is de-energised
and the motor reverses, locking the turret into the desired position.
Note, the position switches on the turret are positioned to be activated once
the turret has passed the tool location. The reversing of the motor rotates the
turret back to lock into the tool position.
There is also a manual change input switch. When activated, the turret will jog
to the next tool position.
Modbus Interface
================
The Emco changer interfaces by a number of Modnus registers as defined below. A
number of the registes are configuration registers and are used to initially
configure the changer. There are also a set of registers that are then used to
control the changer during normal operation.
Config registers
----------------
register 150 Turret Config
This config register is used to enable the EMCO toolchager module. To turn ON
the module, bit 1 needs to be cleared. Therefore 0x00FD should be written to
register 150 to enable the changer.
register 151 Change Delay timeout HI BYTE
register 152 Change Delay timeout LO BYTE
These 2 registers make a 16 bit timeout which if it expires will abort the change
and error. If you set the time out registers 151 and 152 to 0x10 and 00x0, you
will get a time out ofapproximately 30 seconds. each bit in the hi register 151
is worth about 2 seconds. With the default value of 0xFF and 0xFF the timeout
is over 500 seconds
register 153 Reverse Delay timeout HI BYTE
register 154 Reverse Delay timeout LO BYTE
These 2 registers define the time delay between between turning off the forward
relay and indicating that the toolchange has completed. THis delay is to allow
the changer enough time to lock the turret. With the default value of 0xFF and
0xFF the timeout is turned off.
Output Registeres
-----------------
register 1100 Requested Tool
This register contains the tool positon for the next tool change. If this
register contains 0 when the tool change is requezsted, a dummy tool change
occurs. This is a good way to synchronise the Tool Change Counter 1101 output
rgister and the Tool changed count 1201 input register.
register 1101 Tool Change Counter
This register is used to initiate a tool chage operation. Whenever this register
value is changed a tool change occurs. Therefore to change a tool position, the
position to chage to is first written into register 1100, then the contents of
register 1101 are changed. It is best to increment it as this helps debugging.
Input Registeres
-----------------
register 1200 Current Tool
This register contains the current tool positon If this register contains 0
it indicates that the tool changer is "lost"
register 1201 Tool Changed Count
This register is used to determine when a tool chage operation is complete. This
is indicated by this register having the save value as register Tool Change
Counter 1101.
To perform a toolchange, the value of 1101 is changed to initiate the change.
When the change is complete, register 1201 will contain the same value that was
written to 1101.
register 1202 Tool Change Error Code
This register is used to determine the state of the last change request. If the
change was completed with an error, this register will contain 0x0000, otherwise
it will contain an error code.
register 1203 Tool Change Mode
This register contains the changers internal state as the change is occuring. It
is only used for debugging purposes.
Changer Operation
=================
To use the changer, the module must first be enabled by writing 0x02 to register
150.
Initially register 1100 should be written with 0x0000. Then, write0x0001 to
register 1101 to perform a dummy change.
Then to perform a tool change, write the new tool position to register 1100, then
increment register 1101. Register 1201 is then checked until it changes to
the same value of
*******************************************************************************/