Hi Mauro,
The Koyo PLCs support reading the X inputs and Y outputs directly over
Modbus.
The Modicon PLCs do not support this, they can only read the M or MW
memory locations over Modbus. Thus, you will need to modify your ladder logic
to copy the inputs and outputs you need to M or MW locations (note that you may
already be doing this for other purposes).
Here is an example script I run for a Modicon PLC. I am using the MW
locations to read 16-bit analog values and logic bits grouped into 16-bit
words.
I am using the M locations as outputs to write bits from EPICS to the
PLC. These are used to request that the PLC perform certain actions if it is
safe to do so.
######
# Modicon PLC
drvAsynIPPortConfigure("Modicon","10.114.2.71:502",0,1,1)
modbusInterposeConfig("Modicon",0,0)
# Read locations %MW0 to %MW16 as words. Function code=3.
drvModbusAsynConfigure("M1_W000_In", "Modicon",
3, 0, 16, 0, 100, "Modicon")
# Read locations %MW100 to %MW199 as words. Function code=3.
drvModbusAsynConfigure("M1_W100_In", "Modicon",
3, 100, 100, 0, 100, "Modicon")
# Write locations %MW100 to %MW199 as words. Function code=6.
drvModbusAsynConfigure("M1_W100_Out", "Modicon",
6, 100, 100, 0, 1, "Modicon")
# Read locations %MW200 to %MW299 as words. Function code=3.
drvModbusAsynConfigure("M1_W200_In", "Modicon",
3, 200, 100, 0, 100, "Modicon")
# Read locations %MW300 to %MW399 as words. Function code=3.
drvModbusAsynConfigure("M1_W300_In", "Modicon",
3, 300, 100, 0, 100, "Modicon")
# Write locations %MW300 to %MW399 as words. Function code=6.
drvModbusAsynConfigure("M1_W300_Out", "Modicon",
6, 300, 100, 0, 1, "Modicon")
# Access 32 bits %M128 to %M160 as outputs. Function code=5.
drvModbusAsynConfigure("M1_B128_Out", "Modicon",
5, 128, 16, 0, 1, "Modicon")
# Hex trace format on TCP server
asynSetTraceIOMask("Modicon",0,4)
# Turn on asynError and asynTraceIODriver on TCP server
#asynSetTraceMask("Modicon",0,9)
dbLoadTemplate "$(TOP)/db/Modicon.substitutions"
######
This is a part of the contents of Modicon.substitutions, the EPICS
database:
# asyn record for the underlying asyn TCP port
file "$(ASYN)/db/asynRecord.db" { pattern
{P, R, PORT, ADDR,
IMAX, OMAX}
{SR05ID01PLC01: ASYN_REC, Modicon, 0, 80, 80}
}
# These are the Mn inputs done with word access (%MW0 - %MW15)
file "$(MODBUS)/db/bi_word.template" { pattern
{P, R, PORT,
OFFSET, MASK, ZNAM, ONAM, ZSV, OSV, SCAN}
{SR05ID01CCG01:, PRESS_STATUS, M1_W000_In, 0,
0x0001, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG01:, PRESS_LATCH_STATUS, M1_W000_In, 1,
0x0001, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG02:, PRESS_STATUS, M1_W000_In, 0,
0x0002, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG02:, PRESS_LATCH_STATUS, M1_W000_In, 1,
0x0002, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG03:, PRESS_STATUS, M1_W000_In, 0,
0x0004, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG03:, PRESS_LATCH_STATUS, M1_W000_In, 1,
0x0004, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG04:, PRESS_STATUS, M1_W000_In, 0,
0x0008, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG04:, PRESS_LATCH_STATUS, M1_W000_In, 1,
0x0008, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG05:, PRESS_STATUS, M1_W000_In, 0,
0x0010, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
{SR05ID01CCG05:, PRESS_LATCH_STATUS, M1_W000_In, 1,
0x0010, OK, Fault, NO_ALARM, MAJOR, "I/O Intr"}
Let me know if you have questions or problems:
Mark
-----Original Message-----
From: Mauro Giacchini [mailto:[email protected]]
Sent: Tuesday, January 20, 2009 12:15 PM
To: Mark Rivers
Subject: RE: Schneider Electric - BMXP342020 - CPU340-20
Hi Mark,
the goal to me is monitoring few Inputs/Outputs of those PLC,
therefore, I'm looking to a driver/device support.
Have you got someone EPICS ioc application example to me?
I'm reading your documentation but I've found only the Koyo
documentation, not the PLC Schneider.
Thank you very much to your support.
Mauro.
On Jan 20, 2009 06:33 PM, Mark Rivers <[email protected]>
wrote:
> Hi Mauro,
>
> I'm not sure exactly what you are looking for, but I have used my
> EPICS
> Modbus driver and standard asyn device support with these
Schneider
> Modicon PLCs:
>
> http://cars.uchicago.edu/software/epics/modbus
>
> Mark
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Mauro
Giacchini
> Sent: Tuesday, January 20, 2009 10:55 AM
> To: [email protected]
> Subject: PLC: Schneider Electric - BMXP342020 - CPU340-20
>
> Dear all,
> Has anyone a device driver for the PLC Schneider Electric -
BMXP342020
> -
> CPU340-20 ?
> Thanks,
> Mauro.
>
> --
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~
> Mauro Giacchini
>
> Istituto Nazionale di Fisica Nucleare - Laboratori Nazionali di
> Legnaro
> V.le dell'Universita', 2
> 35020 LEGNARO (PD) - ITALY
> Tel. +39.049.8068558
> Fax. +39.049.641925
> Skype yakman000
>
> EPICS _at_ LNL: http://www.lnl.infn.it/~epics/
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mauro Giacchini
Istituto Nazionale di Fisica Nucleare - Laboratori Nazionali di Legnaro
V.le dell’Universita', 2
35020 LEGNARO (PD) – ITALY
Tel. +39.049.8068558
Fax. +39.049.641925
EPICS _at_ LNL http://www.lnl.infn.it/~epics/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~