znelbok
04-30-2010, 05:41 PM
So I have finally gotten around to learning CML and out of that is the first CML driver I have written. Its not the prettiest thing by any means but appears to be working.
This is a driver for the range of Mitsibishi FX0 PLC's and includes the following:
FX0-14
FX0S-10
FX0S-14
FX0S-16
FX0S-20
FX0S-24
FX0S-30
I have had to use Citect to reverse engineer the protocol, which was a time consuming job sending one command out at a time and recording the results and then developing the protocol.
I have a FX0-14, so I have not been able to test the others but it should work as only the number of inputs and outputs change between models.
Fields
AuxRelays - 512 (Auxillary relays for use in ladder logic)
Counters - 16
Dataregisters - 32 (there can be a mix of 16bit and 32 bit data registers - see below)
DisableOutputs - 1 (to stop the PLC writing to any of its outputs)
Inputs - Variable, based on model selected
Offline - Puts the driver off line so you can configure the PLC with the appropriate software.
Outputs - Variable, based on model selected
ReloadConfig - to reload the dataregister configuration
staterelays - 64 (similar to Axillary relays)
Timers - 56
Timerstate - 56 (boolean field to indicate a timer is active or not).
I don't expect that anyone will have one, but just in case they do the driver is here. You can find them on ebay as well.
Data Registers
When you use 32bit data registers, it takes up two 16 bit data registers. Thus if you have data register 16 as a 32 bit register, data register 17 is not available.
To accommodate this I have a config file (FX0-Config.csv) that is a list of all 32bit data registers that the driver needs. It will then not create the 16bit data registers as required
eg
If the file contains one value only of 16, then fields DataReg_D16 & DataReg_D17 will not be created, and a field DataReg32_D16 is created.
The file is a CSV file that needs to be in
C:\Program Files\CQC\CQCData\MacroFileRoot\Drivers\Mitusbishi PLC
An example file is also attached. Remove the .txt from the end of the file name.
Have fun
Mick
This is a driver for the range of Mitsibishi FX0 PLC's and includes the following:
FX0-14
FX0S-10
FX0S-14
FX0S-16
FX0S-20
FX0S-24
FX0S-30
I have had to use Citect to reverse engineer the protocol, which was a time consuming job sending one command out at a time and recording the results and then developing the protocol.
I have a FX0-14, so I have not been able to test the others but it should work as only the number of inputs and outputs change between models.
Fields
AuxRelays - 512 (Auxillary relays for use in ladder logic)
Counters - 16
Dataregisters - 32 (there can be a mix of 16bit and 32 bit data registers - see below)
DisableOutputs - 1 (to stop the PLC writing to any of its outputs)
Inputs - Variable, based on model selected
Offline - Puts the driver off line so you can configure the PLC with the appropriate software.
Outputs - Variable, based on model selected
ReloadConfig - to reload the dataregister configuration
staterelays - 64 (similar to Axillary relays)
Timers - 56
Timerstate - 56 (boolean field to indicate a timer is active or not).
I don't expect that anyone will have one, but just in case they do the driver is here. You can find them on ebay as well.
Data Registers
When you use 32bit data registers, it takes up two 16 bit data registers. Thus if you have data register 16 as a 32 bit register, data register 17 is not available.
To accommodate this I have a config file (FX0-Config.csv) that is a list of all 32bit data registers that the driver needs. It will then not create the 16bit data registers as required
eg
If the file contains one value only of 16, then fields DataReg_D16 & DataReg_D17 will not be created, and a field DataReg32_D16 is created.
The file is a CSV file that needs to be in
C:\Program Files\CQC\CQCData\MacroFileRoot\Drivers\Mitusbishi PLC
An example file is also attached. Remove the .txt from the end of the file name.
Have fun
Mick