I have a fix for that that I've been testing.
I'll generate a patch and send it to you.
The solution is that in the initialization portion of the driver, if the tag
is just a boolean tag by itself, set the mask to 255 so that all the bits
get set and reset.
David
On 8/24/11 5:47 PM, "Kasemir, Kay" <[email protected]> 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
>
>
>
David
--
"... The Crossbow Project. There's No Defense Like a Good Offense. " - Real
Genius (1985)
Don't think it exists? Google the Air Force X-37B project.
- References:
- ether_ip driver for ControlLogix PLCs and 'BOOL' tags Kasemir, Kay
- Navigate by Date:
- Prev:
Re: blockingSockTest error Andrew Johnson
- Next:
RE: Dynamic images in BOY Mark Rivers
- 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
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
ether_ip driver for ControlLogix PLCs and 'BOOL' tags Kasemir, Kay
- Next:
Re: ether_ip driver for ControlLogix PLCs and 'BOOL' tags John William Sinclair
- 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
2021
2022
2023
2024
|