EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: 高振华 <gaozh at ihep.ac.cn>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Sat, 6 Feb 2021 12:39:37 +0000
Hi Zhenhua,


Does it support reading the current state of output words and coils, but just at a different address from that used for writing to them?  If so, is the offset from the write address to the read address constant?  If so, then we can change the driver to make a special case for Pilz, just as we currently do for Wago.


Mark



________________________________
From: 高振华 <gaozh at ihep.ac.cn>
Sent: Saturday, February 6, 2021 3:06 AM
To: Mark Rivers
Cc: tech-talk at aps.anl.gov
Subject: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC


Hi Mark,
I'll contact the engineers at Pilz headquarters to ask if it's possible to set a memory address to be both readable and writable.
Beijing pilz branch engineer said a memory address can only be set to write-only or read-only.
thanks.

Best regards.
Gao Zhenhua


> -----原始邮件-----
> 发件人: "Mark Rivers" <rivers at cars.uchicago.edu>
> 发送时间: 2021-02-05 19:51:03 (星期五)
> 收件人: "高振华" <gaozh at ihep.ac.cn>
> 抄送: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
> 主题: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC
>
> Hi Zhenhua,
>
>
> > An output coil must be configured to both register addresses for the upper computer to read and write,
> > One is the reading address of function code 3 and the other is the writing address of function code 16.
> > Do I also need to set pollMsec to 0 when writing to bit?
>
> Pilz says it is possible to configure an output coil to be both writeable and readable.  If you do that, then you don't need to set pollMsec to 0 for function code 16. You can set it to non-zero and it will do the initial readback so the bo record agree with the hardware at iocInit.
>
> Mark
>
>
> ________________________________
> From: 高振华 <gaozh at ihep.ac.cn>
> Sent: Friday, February 5, 2021 2:06 AM
> To: Mark Rivers
> Cc: tech-talk at aps.anl.gov
> Subject: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC
>
>
> Hi Mark,
> Thanks a lot, I'm not going to deal with these undefined parameters.
> Pilz replied that it could not configure a word register address to be readable and write.
> An output coil must be configured to both register addresses for the upper computer to read and write,
> One is the reading address of function code 3 and the other is the writing address of function code 16.
> So the first solution has to be taken(Set pollMsec to 0).
> Do I also need to set pollMsec to 0 when writing to bit?
>
> Best regards.
> Gao Zhenhua
>
>
>
> > -----原始邮件-----
> > 发件人: "Mark Rivers" <rivers at cars.uchicago.edu>
> > 发送时间: 2021-02-04 20:21:41 (星期四)
> > 收件人: "高振华" <gaozh at ihep.ac.cn>
> > 抄送: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
> > 主题: Re: RE: Re: Re: modbus write registers error to Pilz PLC
> >
> > Hi Zhenhua,
> >
> >
> > > But it shows that some parameters are not defined,For example, MODBUS_READ, Timestamp and so on are not defined.
> > > How to deal with it?
> >
> >
> > These undefined values in the parameter table are normal.  I see the same thing in my running IOCs.  It just means that you have not written to those values from an EPICS client, so their values have not been set.
> >
> > Parameter 0 type=asynInt32, name=MODBUS_DATA, value is undefined
> > Parameter 1 type=asynInt32, name=MODBUS_READ, value is undefined
> > Parameter 2 type=asynUInt32Digital, name=ENABLE_HISTOGRAM, value is undefined
> > Parameter 3 type=asynInt32, name=READ_HISTOGRAM, value is undefined
> > Parameter 4 type=asynInt32, name=HISTOGRAM_BIN_TIME, value is undefined
> > Parameter 5 type=asynInt32Array, name=HISTOGRAM_TIME_AXIS, value is undefined
> > Parameter 6 type=asynFloat64, name=POLL_DELAY, value is undefined
> >
> > Mark
> >
> > ________________________________
> > From: 高振华 <gaozh at ihep.ac.cn>
> > Sent: Thursday, February 4, 2021 3:15 AM
> > To: Mark Rivers
> > Cc: tech-talk at aps.anl.gov
> > Subject: Re: RE: Re: Re: modbus write registers error to Pilz PLC
> >
> >
> > Hi Mark,
> > Sorry,I accidentally deleted the iocInit command while modifying the.cmd file, After adding iocInit command, The IOC is now working properly,
> > But it shows that some parameters are not defined,For example, MODBUS_READ, Timestamp and so on are not defined.
> > How to deal with it?
> > This is the result of the run:
> > 2021/02/04 10:08:09.715 192.168.70.40:502 write 12
> >
> > 00 01 00 00 00 06 ff 03 00 03 00 03
> > 2021/02/04 10:08:09.798 192.168.70.40:502 read 15
> >
> > 00 01 00 00 00 09 ff 03 06 00 00 00 00 00 00
> > iocRun: All initialization complete
> > asynReport 1
> > Koyo1 multiDevice:No canBlock:Yes autoConnect:Yes
> >     enabled:Yes connected:Yes numberConnects 1
> >     nDevices 0 nQueued 0 blocked:No
> >     asynManagerLock:No synchronousLock:No
> >     exceptionActive:No exceptionUsers 1 exceptionNotifys 0
> >     traceMask:0x9 traceIOMask:0x4 traceInfoMask:0x1
> >     Port 192.168.70.40:502: Connected
> > K1_Xn_Word multiDevice:Yes canBlock:Yes autoConnect:Yes
> >     enabled:Yes connected:Yes numberConnects 1
> >     nDevices 1 nQueued 0 blocked:No
> >     asynManagerLock:No synchronousLock:No
> >     exceptionActive:No exceptionUsers 0 exceptionNotifys 0
> >     traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
> >     addr 0 autoConnect Yes enabled Yes connected Yes exceptionActive No
> >         exceptionActive No exceptionUsers 1 exceptionNotifys 0
> >         blocked No
> >         traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
> > modbus port: K1_Xn_Word
> >     asynOctet server:   Koyo1
> >     modbusSlave:        255
> >     modbusFunction:     3
> >     modbusStartAddress: 03
> >     modbusLength:       03
> >     absoluteAddressing: false
> >     plcType:
> >     I/O errors:         0
> >     Read OK:            1
> >     Write OK:           0
> >     pollDelay:          0.100000
> >     Time for last I/O   84 msec
> >     Max. I/O time:      84 msec
> >     Time per hist. bin: 1 msec
> > Port: K1_Xn_Word
> >   Timestamp: <undefined>
> >   Input EOS[0]:
> >   Output EOS[0]:
> > Parameter list 0
> > Number of parameters is: 12
> > Parameter 0 type=asynInt32, name=MODBUS_DATA, value is undefined
> > Parameter 1 type=asynInt32, name=MODBUS_READ, value is undefined
> > Parameter 2 type=asynUInt32Digital, name=ENABLE_HISTOGRAM, value is undefined
> > Parameter 3 type=asynInt32, name=READ_HISTOGRAM, value is undefined
> > Parameter 4 type=asynInt32, name=HISTOGRAM_BIN_TIME, value is undefined
> > Parameter 5 type=asynInt32Array, name=HISTOGRAM_TIME_AXIS, value is undefined
> > Parameter 6 type=asynFloat64, name=POLL_DELAY, value is undefined
> > Parameter 7 type=asynInt32, name=READ_OK, value=1, status=0
> > Parameter 8 type=asynInt32, name=WRITE_OK, value=0, status=0
> > Parameter 9 type=asynInt32, name=IO_ERRORS, value=0, status=0
> > Parameter 10 type=asynInt32, name=LAST_IO_TIME, value=84, status=0
> > Parameter 11 type=asynInt32, name=MAX_IO_TIME, value=84, status=0
> > K1_Yn_Out_Word multiDevice:Yes canBlock:Yes autoConnect:Yes
> >     enabled:Yes connected:Yes numberConnects 1
> >     nDevices 1 nQueued 0 blocked:No
> >     asynManagerLock:No synchronousLock:No
> >     exceptionActive:No exceptionUsers 0 exceptionNotifys 0
> >     traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
> >     addr 0 autoConnect Yes enabled Yes connected Yes exceptionActive No
> >         exceptionActive No exceptionUsers 1 exceptionNotifys 0
> >         blocked No
> >         traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
> > modbus port: K1_Yn_Out_Word
> >     asynOctet server:   Koyo1
> >     modbusSlave:        255
> >     modbusFunction:     6
> >     modbusStartAddress: 00
> >     modbusLength:       01
> >     absoluteAddressing: false
> >     plcType:
> >     I/O errors:         0
> >     Read OK:            0
> >     Write OK:           0
> >     pollDelay:          0.000000
> >     Time for last I/O   0 msec
> >     Max. I/O time:      0 msec
> >     Time per hist. bin: 1 msec
> > Port: K1_Yn_Out_Word
> >   Timestamp: <undefined>
> >   Input EOS[0]:
> >   Output EOS[0]:
> > Parameter list 0
> > Number of parameters is: 12
> > Parameter 0 type=asynInt32, name=MODBUS_DATA, value is undefined
> > Parameter 1 type=asynInt32, name=MODBUS_READ, value is undefined
> > Parameter 2 type=asynUInt32Digital, name=ENABLE_HISTOGRAM, value is undefined
> > Parameter 3 type=asynInt32, name=READ_HISTOGRAM, value is undefined
> > Parameter 4 type=asynInt32, name=HISTOGRAM_BIN_TIME, value is undefined
> > Parameter 5 type=asynInt32Array, name=HISTOGRAM_TIME_AXIS, value is undefined
> > Parameter 6 type=asynFloat64, name=POLL_DELAY, value is undefined
> > Parameter 7 type=asynInt32, name=READ_OK, value=0, status=0
> > Parameter 8 type=asynInt32, name=WRITE_OK, value=0, status=0
> > Parameter 9 type=asynInt32, name=IO_ERRORS, value=0, status=0
> > Parameter 10 type=asynInt32, name=LAST_IO_TIME, value=0, status=0
> > Parameter 11 type=asynInt32, name=MAX_IO_TIME, value=0, status=0
> > K1_Cn_Out_Word_Array multiDevice:Yes canBlock:Yes autoConnect:Yes
> >     enabled:Yes connected:Yes numberConnects 1
> >     nDevices 1 nQueued 0 blocked:No
> >     asynManagerLock:No synchronousLock:No
> >     exceptionActive:No exceptionUsers 0 exceptionNotifys 0
> >     traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
> >     addr 0 autoConnect Yes enabled Yes connected No exceptionActive No
> >         exceptionActive No exceptionUsers 0 exceptionNotifys 0
> >         blocked No
> >         traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
> > modbus port: K1_Cn_Out_Word_Array
> >     asynOctet server:   Koyo1
> >     modbusSlave:        255
> >     modbusFunction:     16
> >     modbusStartAddress: 00
> >     modbusLength:       03
> >     absoluteAddressing: false
> >     plcType:
> >     I/O errors:         0
> >     Read OK:            0
> >     Write OK:           0
> >     pollDelay:          0.000000
> >     Time for last I/O   0 msec
> >     Max. I/O time:      0 msec
> >     Time per hist. bin: 1 msec
> > Port: K1_Cn_Out_Word_Array
> >   Timestamp: <undefined>
> >   Input EOS[0]:
> >   Output EOS[0]:
> > Parameter list 0
> > Number of parameters is: 12
> > Parameter 0 type=asynInt32, name=MODBUS_DATA, value is undefined
> > Parameter 1 type=asynInt32, name=MODBUS_READ, value is undefined
> > Parameter 2 type=asynUInt32Digital, name=ENABLE_HISTOGRAM, value is undefined
> > Parameter 3 type=asynInt32, name=READ_HISTOGRAM, value is undefined
> > Parameter 4 type=asynInt32, name=HISTOGRAM_BIN_TIME, value is undefined
> > Parameter 5 type=asynInt32Array, name=HISTOGRAM_TIME_AXIS, value is undefined
> > Parameter 6 type=asynFloat64, name=POLL_DELAY, value is undefined
> > Parameter 7 type=asynInt32, name=READ_OK, value=0, status=0
> > Parameter 8 type=asynInt32, name=WRITE_OK, value=0, status=0
> > Parameter 9 type=asynInt32, name=IO_ERRORS, value=0, status=0
> > Parameter 10 type=asynInt32, name=LAST_IO_TIME, value=0, status=0
> > Parameter 11 type=asynInt32, name=MAX_IO_TIME, value=0, status=0
> > 2021/02/04 10:08:10.299 192.168.70.40:502 write 12
> >
> > 00 02 00 00 00 06 ff 03 00 03 00 03
> > epics> 2021/02/04 10:08:10.398 192.168.70.40:502 read 15
> >
> > 00 02 00 00 00 09 ff 03 06 00 00 00 00 00 00
> > 2021/02/04 10:08:10.499 192.168.70.40:502 write 12
> >
> > 00 03 00 00 00 06 ff 03 00 03 00 03
> > 2021/02/04 10:08:10.598 192.168.70.40:502 read 15
> >
> >
> > Thanks.
> > Gao Zhenhua
> >
> >
> >
> >
> >
> > > -----原始邮件-----
> > > 发件人: "Mark Rivers" <rivers at cars.uchicago.edu>
> > > 发送时间: 2021-02-04 03:27:58 (星期四)
> > > 收件人: "'高振华'" <gaozh at ihep.ac.cn>
> > > 抄送: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
> > > 主题: RE: Re: Re: modbus write registers error to Pilz PLC
> > >
> > > I am puzzled.  It looks like you sent the complete output when the IOC boots, but I don't see an iocInit command?  Perhaps that is why dbstat is crashing the IOC?
> > >
> > > Make sure you are calling iocInit.  After iocInit type this command:
> > >
> > > asynReport 1
> > >
> > > That will show you the status of each asyn port.
> > >
> > > Mark
> > >
> > >
> > > -----Original Message-----
> > > From: 高振华 <gaozh at ihep.ac.cn>
> > > Sent: Wednesday, February 3, 2021 2:23 AM
> > > To: Mark Rivers <rivers at cars.uchicago.edu>
> > > Cc: tech-talk at aps.anl.gov
> > > Subject: Re: Re: Re: modbus write registers error to Pilz PLC
> > >
> > >
> > > Hi Mark,
> > >
> > > I am contacting Pilz to see if it is possible to make the write address readable and write  (I am new to Pilz PLC and not familiar with its configuration process).
> > >
> > > I tried the first method,
> > > 1) Set pollMsec=0 in the drvAsynModbusConfigure command for write operations.
> > > Set the pollMsec parameter for function codes 6 and 16 to 0, There was no error when starting IOC,However, function code 3's sending and receiving information is only displayed once and will not update the display (when tracing).
> > > To view the status, use the dbstat command to display the following information:
> > > segmentation fault(core dumped).
> > > How to resolve this problem?
> > > The following information is displayed when starting IOC:
> > > [root@localhost iocTest]# ./Koyo1.cmd
> > > #!./../../bin/linux-x86_64/modbusApp
> > > < envPaths
> > > epicsEnvSet("IOC","iocTest")
> > > epicsEnvSet("TOP","/opt/epics/support/modbus")
> > > epicsEnvSet("SUPPORT","/opt/epics/support")
> > > epicsEnvSet("ASYN","/opt/epics/support/asyn")
> > > epicsEnvSet("EPICS_BASE","/opt/epics/base")
> > > dbLoadDatabase("../../dbd/modbus.dbd")
> > > modbus_registerRecordDeviceDriver(pdbbase)
> > > # Use the following commands for TCP/IP
> > > drvAsynIPPortConfigure("Koyo1","192.168.70.40:502",0,0,1)
> > > asynSetOption("Koyo1",0, "disconnectOnReadTimeout", "Y")
> > > modbusInterposeConfig("Koyo1",0,5000,0)
> > > # The DL205 has word access to the Xn inputs at Modbus offset 40400 (octal) # Read 8 words (128 bits).  Function code=3.
> > > #drvModbusAsynConfigure("K1_Xn_Word",     "Koyo1", 0, 3, 040400, 010,    0,  100, "Koyo")
> > > drvModbusAsynConfigure("K1_Xn_Word",     "Koyo1", 255, 3, 0x3,0x3,   0,  100, "Koyo")
> > > # Write 8 words (128 bits).  Function code=6.
> > > #drvModbusAsynConfigure("K1_Yn_Out_Word", "Koyo1", 255, 6, 0x0, 0x03,  0,  100, "Koyo") drvModbusAsynConfigure("K1_Yn_Out_Word", "Koyo1", 255, 6, 0x0, 0x03,  0,  0, "Koyo") # We access the same 16 words (C0-C377) as array outputs (256 bits). Function code=16.
> > > #drvModbusAsynConfigure("K1_Cn_Out_Word_Array", "Koyo1", 255, 16, 0x0, 0x3,    0,   1, "Koyo")
> > > drvModbusAsynConfigure("K1_Cn_Out_Word_Array", "Koyo1", 255, 16, 0x0, 0x3,    0,   0, "Koyo")
> > > # Enable ASYN_TRACEIO_HEX on octet server
> > > asynSetTraceIOMask("Koyo1",0,4)
> > > # Enable ASYN_TRACE_ERROR and ASYN_TRACEIO_DRIVER on octet server
> > > asynSetTraceMask("Koyo1",0,9)
> > > dbLoadTemplate("Koyo1.substitutions")
> > > 2021/02/03 11:11:03.048 192.168.70.40:502 write 12
> > >
> > > 00 01 00 00 00 06 ff 03 00 03 00 03
> > > 2021/02/03 11:11:03.058 192.168.70.40:502 read 15
> > >
> > > 00 01 00 00 00 09 ff 03 06 00 00 00 00 00 00
> > > epics> dbstat
> > > Segmentation fault (core dumped)
> > > [root@localhost iocTest]#
> > >
> > > thank you very much,
> > > Gao Zhenhua
> > >
> > >
> > >
> > > > -----原始邮件-----
> > > > 发件人: "高振华" <gaozh at ihep.ac.cn>
> > > > 发送时间: 2021-02-01 08:13:20 (星期一)
> > > > 收件人: "mark rivers" <rivers at cars.uchicago.edu>
> > > > 抄送: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
> > > > 主题: Re: Re: modbus write registers error to Pilz PLC
> > > >
> > > >
> > > > Hi Mark,
> > > > Thank you very much for your advice,I will test it soon.
> > > >
> > > > Best Wishes,
> > > > Gao Zhenhua
> > > >
> > > >
> > > > > -----原始邮件-----
> > > > > 发件人: "Mark Rivers" <rivers at cars.uchicago.edu>
> > > > > 发送时间: 2021-01-31 21:38:12 (星期日)
> > > > > 收件人: "高振华" <gaozh at ihep.ac.cn>, "tech-talk at aps.anl.gov"
> > > > > <tech-talk at aps.anl.gov>
> > > > > 抄送:
> > > > > 主题: Re: modbus write registers error to Pilz PLC
> > > > >
> > > > > Hi Zhenhua,
> > > > >
> > > > >
> > > > > I believe I understand the problem.   Here is some text from the EPICS Modbus documentation (https://epics-modbus.readthedocs.io/en/latest/) that explains the issue:
> > > > >
> > > > >
> > > > > ***************************************************************
> > > > >
> > > > > For write operations it is possible to specify that a single read operation should be done when the port driver is created. This is normally used so that EPICS obtains the current value of an output device when the IOC is initialized.
> > > > >
> > > > > ...
> > > > >
> > > > > drvModbusAsynConfigure(portName,
> > > > >                        tcpPortName,
> > > > >                        slaveAddress,
> > > > >                        modbusFunction,
> > > > >                        modbusStartAddress,
> > > > >                        modbusLength,
> > > > >                        dataType,
> > > > >                        pollMsec,
> > > > >                        plcType);
> > > > > ...
> > > > >
> > > > > pollMsec   int   Polling delay time in msec for the polling thread for read functions. For write functions, a non-zero value means that the Modbus data should be read once when the port driver is first created.
> > > > > ...
> > > > > Note for Wago devices
> > > > > This initial read operation is normally done at the same Modbus address as the write operations. However, Wago devices are different from other Modbus devices because the address to read back a register is not the same as the address to write the register. For Wago devices the address used to read back the initial value for a Modbus write function must be 0x200 greater than the address for the write function. This is handled by adding this 0x200 offset for the readback address if the plcType argument to drvModbusAsynConfigure contains the substring “Wago” (case sensitive). Note that this does not affect the address for Wago read functions. The user must specify the actual Modbus address for read functions.
> > > > > ***************************************************************
> > > > >
> > > > > So when you create the ports for the output operations it is trying to read the current values from those registers because you have specified a non-zero value for pollMsec in your drvModbusAsynConfigure command.  That is generating Modbus exception 2 because the Pilz 4000 does not allow read operations on those registers.  There are 3 options to fix this problem:
> > > > >
> > > > > 1) Set pollMsec=0 in the drvAsynModbusConfigure command for write operations.  This will fix the problem, but it means that the initial value of the output PV will not agree with the actual hardware value when the IOC boots.  That may or may not be OK for you.
> > > > >
> > > > > 2) If possible configure the Pilz 4000 to allow read access to the same register addresses that it uses for write operations.
> > > > >
> > > > > 3) If option 1 or 2 does not work for you then modify the driver so that if the plcType is Pilz4000 it uses an offset between the write and read addresses.  This is what is done for the Wago devices which have a similar problem.
> > > > >
> > > > > Mark
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: 高振华 <gaozh at ihep.ac.cn>
> > > > > Sent: Sunday, January 31, 2021 6:56 AM
> > > > > To: Mark Rivers; tech-talk at aps.anl.gov
> > > > > Subject: modbus write registers error to Pilz PLC
> > > > >
> > > > > Hello Mark,
> > > > > Can Modbus R2-11 be used on the Pilz 4000 PLC?
> > > > > I am using the PILZ 4000 PLC, but an error exception=2 occurred while debugging Modbus TCP communication.
> > > > > The IOC has been able to read multiple register (function code 3),
> > > > > But cannot write to a single register and write to multiple registers(function code 6 and function code 16),Error: exception=2.
> > > > > Examples of Pilz PLC's command and return value formats are as follows:
> > > > > (Confirmed with LabVIEW program)
> > > > > Function code 6:
> > > > > command: 0000 0000 0006 0106 0000 6262,
> > > > > Note: 12 bytes in total.
> > > > > Function code 16: Write three words
> > > > > command: 0000 0000 000D 0110 0000 0003 0662 6263 6364 64
> > > > > Note: 19 bytes in total.
> > > > > PLC(server) read-write register address allocation during test is as
> > > > > follows: (data type:word)
> > > > > 4x0001 to 4x0003 are the write addresses(0x0 to 0x2), (computer
> > > > > writes to the PLC),
> > > > > 4x0004 to 4x0006 are read addresses(0x3 to 0x5), (computer reads
> > > > > from the PLC)
> > > > >
> > > > > Here is Koyo1.cmd file:
> > > > > dbLoadDatabase("../../dbd/modbus.dbd")
> > > > > modbus_registerRecordDeviceDriver(pdbbase)
> > > > > #drvAsynIPPortConfigure("Koyo1","164.54.160.158:502",0,0,1)
> > > > > drvAsynIPPortConfigure("Koyo1","192.168.70.40:502",0,0,1)
> > > > > asynSetOption("Koyo1",0, "disconnectOnReadTimeout", "Y")
> > > > > modbusInterposeConfig("Koyo1",0,5000,0)
> > > > > # The DL205 has word access to the Xn inputs at Modbus offset 40400
> > > > > (octal) # Read 8 words (128 bits).  Function code=3.
> > > > > #drvModbusAsynConfigure("K1_Xn_Word",     "Koyo1", 0, 3, 040400, 010,    0,  100, "Koyo")
> > > > > drvModbusAsynConfigure("K1_Xn_Word",     "Koyo1", 255, 3, 0x3,0x3,   0,  100, "Koyo")
> > > > >
> > > > > # Write 8 words (128 bits).  Function code=6.
> > > > > #drvModbusAsynConfigure("K1_Yn_Out_Word", "Koyo1", 0, 6, 040500, 010,    0,  100, "Koyo")
> > > > > drvModbusAsynConfigure("K1_Yn_Out_Word", "Koyo1", 255, 6, 0x0, 0x03,
> > > > > 0,  100, "Koyo")
> > > > >
> > > > > # We access the same 16 words (C0-C377) as array outputs (256 bits). Function code=16.
> > > > > #drvModbusAsynConfigure("K1_Cn_Out_Word_Array", "Koyo1", 0, 16, 040600, 020,    0,   1, "Koyo")
> > > > > drvModbusAsynConfigure("K1_Cn_Out_Word_Array", "Koyo1", 255, 16, 0x0, 0x3,    0,   1, "Koyo")
> > > > >
> > > > > asynSetTraceIOMask("Koyo1",0,4)
> > > > > asynSetTraceMask("Koyo1",0,9)
> > > > > dbLoadTemplate("Koyo1.substitutions")
> > > > > iocInit
> > > > > Here is Koyo1.substitutions file:
> > > > > # These are the Yn outputs done with word access.  Y0-Y7 file
> > > > > "../../db/bo_word.template" { pattern
> > > > > {P,           R,          PORT,               OFFSET,   MASK,      ZNAM,   ONAM}
> > > > > {KOYO1:,    Y0OutW,     K1_Yn_Out_Word,     0,        0x0001,    Low,    High}
> > > > > {KOYO1:,    Y1OutW,     K1_Yn_Out_Word,     0,        0x0002,    Low,    High}
> > > > > {KOYO1:,    Y2OutW,     K1_Yn_Out_Word,     0,        0x0004,    Low,    High}
> > > > > {KOYO1:,    Y3OutW,     K1_Yn_Out_Word,     0,        0x0008,    Low,    High}
> > > > > {KOYO1:,    Y4OutW,     K1_Yn_Out_Word,     0,        0x0010,    Low,    High}
> > > > > {KOYO1:,    Y5OutW,     K1_Yn_Out_Word,     0,        0x0020,    Low,    High}
> > > > > {KOYO1:,    Y6OutW,     K1_Yn_Out_Word,     0,        0x0040,    Low,    High}
> > > > > {KOYO1:,    Y7OutW,     K1_Yn_Out_Word,     0,        0x0080,    Low,    High}
> > > > > }
> > > > > file "../../db/intarray_out.template" { pattern
> > > > > {P,           R,            PORT,                  NELM}
> > > > > {KOYO1:,    CnOutWArray,  K1_Cn_Out_Word_Array,    3}
> > > > > }
> > > > >
> > > > > Here is bo_word.template file:
> > > > > [cid:54cafd04$1$17758759031$Coremail$gaozh$ihep.ac.cn]
> > > > > Here is intarray_out.template file:
> > > > > [cid:67c8a56d$2$17758759032$Coremail$gaozh$ihep.ac.cn]
> > > > > Why is INP here instead of OUT?
> > > > > drvModbusAsynConfigure function with function code 6: starting address 0x0, length 0x3.
> > > > > [cid:5d690bc3$3$17758784fdc$Coremail$gaozh$ihep.ac.cn]
> > > > > drvModbusAsynConfigure function with function code 16: starting address 0x0, length 0x3.
> > > > > [cid:4b2a765d$4$177587b0f7a$Coremail$gaozh$ihep.ac.cn]
> > > > > Please help to see what the reason is?
> > > > > My application environment:
> > > > > EPICS 7.0.3
> > > > > Asyn R4-33
> > > > > Modbus R2-11
> > > > >
> > > > > Thanks
> > > > > Gao Zhenhua
> > > > > --
> > > > > BSRF(Beijing Synchrotron Radiation Facility)
> > > > > Email:gaozh at ihep.ac.cn<mailto:gaozh at ihep.ac.cn>
> > >
> > >
> > >
> > >
> >
> >
> > --
> >
> > 祝好!
> > 高振华
> >
> >
> > 电话:010-88235426
> > Email:gaozh at ihep.ac.cn
> >
> >
>
>
> --
>
> 祝好!
> 高振华
>
>
> 电话:010-88235426
> Email:gaozh at ihep.ac.cn
>
>


--

祝好!
高振华


电话:010-88235426
Email:gaozh at ihep.ac.cn



Replies:
Re: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
References:
modbus write registers error to Pilz PLC 高振华 via Tech-talk
Re: modbus write registers error to Pilz PLC Mark Rivers via Tech-talk
Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
Re: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
RE: Re: Re: modbus write registers error to Pilz PLC Mark Rivers via Tech-talk
Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
Re: RE: Re: Re: modbus write registers error to Pilz PLC Mark Rivers via Tech-talk
Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC Mark Rivers via Tech-talk
Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk

Navigate by Date:
Prev: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
Next: RE: Dynamic user limits in softMotor Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
Next: Re: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 07 Feb 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·