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  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ether_ip driver for ControlLogix PLCs and 'BOOL' tags
From: John William Sinclair <[email protected]>
To: "Kasemir, Kay" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Wed, 24 Aug 2011 22:26:55 -0400
I routinely define records as shown below an never see such behavior. Writes
set individual bits of a DINT. Why is that fundamentally different?

record(bi,"$(db):BlvIr1:OpnSR") {
 field(SCAN,"1 second")
 field(ZNAM, "0")
 field(ONAM, "1")
 field(DTYP, "EtherIP")
# field(INP, "@hrenbt02Cpu1 BlvIr1_OpnSR")
 field(INP, "@hrenbt02Cpu1 epics_inputs[3] B 11")
}

record(bi,"$(db):BlvIr1:ClsSR") {
 field(SCAN,"1 second")
 field(ZNAM, "0")
 field(ONAM, "1")
 field(DTYP, "EtherIP")
# field(INP, "@hrenbt02Cpu1 BlvIr1_ClsSR")
 field(INP, "@hrenbt02Cpu1 epics_inputs[3] B 12")
}

Best,
John Sinclair

Kasemir, Kay wrote:
Hi:

Martin Smith @ APS has found a quirk in the way the ether_ip driver for
ControlLogix PLCs and the PLC handle 'BOOL' tags that might be of interest
to those that use the driver.

The short summary is that you cannot use BI or BO records with plain BOOL
tags on the PLC.

The binary record support in the ether_ip driver is meant for efficient
handling of _bits_. It can read and write bits in a BOOL[], DINT, DINT[]
tag. In those cases it reads or writes the whole numbers over the network,
then dispatches the individual bits to records.

For example, say record A is attached to BOOL[0] or DINT.0,
record B is attached to BOOL[1] or DINT.1 and so on.
Meaning the records are attached to the bits of a DINT, DINT[] or BOOL[].
That all works fine: The driver reads or writes the whole DINT or DINT array
or BOOL array and performs the appropriate bit fiddling to interface the
bits to records.

But if you attach a binary record to a plain, scalar BOOL tag on the PLC,
the following happens:
The driver still wants to read or write individual bits.
A BO record with OUT="@plc MyBOOLTag" will read or write 0 and 1 values.
The PLC, however, returns 0 for 'false' and 255 for 'true'.

The mismatch between 1 and 255 is the issue at the root of the problem that
Martin found in a setup:

A BO record would write a "1". The PLC now actually sets the BOOL tag to
255, and the driver from now on sees 255 as a value.
If the driver is instructed to write a "0" for the BO record, it will write
254, i.e. the received value of 255 with the first bit set to 0.
The PLC, however, considers 254!=0 also as 'true' and keeps the BOOL tag at
255.

Longer summary:
Use binary records (BI, BO, MBBI, MBBO) with BOOL[], DINT or DINT[].
Not with individual BOOL tags, which - even if it were supported - would be
slower than array transfers anyway.

Thanks,
Kay





Replies:
Re: ether_ip driver for ControlLogix PLCs and 'BOOL' tags Kasemir, Kay
References:
ether_ip driver for ControlLogix PLCs and 'BOOL' tags Kasemir, Kay

Navigate by Date:
Prev: RE: Dynamic images in BOY Mark Rivers
Next: RE: question about best IDEs for Windows/Cygwin-x86, GCC, EPICS in EPICS community James.OHea
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: ether_ip driver for ControlLogix PLCs and 'BOOL' tags David Dudley
Next: Re: ether_ip driver for ControlLogix PLCs and 'BOOL' tags Kasemir, Kay
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·