EPICS Home

Experimental Physics and Industrial Control System


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

Subject: EtherIP driver, BOOL tags
From: Kay-Uwe Kasemir <[email protected]>
To: tech talk <[email protected]>
Date: Wed, 15 Nov 2006 15:58:46 -0500
Hi:

Andrew just reminded me that some people have run into problems with binary records
and BOOL tags when using the 'EtherIP' driver for AllenBradley ControlLogix PLCs.
Looks like we finally figured it out.


Thanks to Andrew for sending the detailed debug output of the driver for one such instance!

So here's some rather long sermon, which hopefully will help in the future when
people search tech-talk for similar issues...


-Kay



Symptom:
A BO record can write a '1' to turn something on the PLC 'on',
but when later writing a '0' to turn it 'off' again,
that seems to have no effect.

Reason/explanation/underlying problem:
The EtherIP support for binary records addresses bits:
1 bit for the BO/BI, NOBT for the MBBO/MBBI, ...,
because that seemed like a reasonable idea at the time.

Problem 1:
The underlying network protocol doesn't fully distinguish between writing bits
in a BOOL array and bits of a DINT (array).
When writing BOOL[2], that's actually the same as writing DINT.2,
meaning: third BOOL array element, couting from 0,
is the same as the third bit in a DINT.
A single DINT is the same as a DINT array with only one element.
When writing to BOOL[32], that's actually the same as writing DINT[1].0.
Both refer to the 33rd bit (counting from 0) in some memory structure.
So complcation #1 arises when your BO record writes to 'fred[2]',
and you think that's DINT array 'fred', third element,
but the driver will actually deal with the third bit of the first element.
--> Use BOOL for binary records, or read the driver's readme about the "B"
flag for accessing bits in non-BOOL tags.


Problem 2:
When we write a '1' to a bit in a BOOL array,
that bit will read back as '1'
(assuming that nothing else on the PLC changes it).
The driver is specifically written to handle that case:
The BO records will only touch bits.

However, write '1' to a scalar BOOL tag, it reads back as '255'.
Which is OK, both values are considered 'on' by PLC logic.
But if you now write a '0' to that tag,
the driver will only write a zero bit,
using the last readback.
Meaning: it ends up writing 254 = 255 - bit 0,
and the PLC will still consider that 'on'.
--> Use binary records with BOOL _arrays_.
That works, and is more efficient than single BOOL tags anyway.
If you have to deal with a single BOOL tag,
remember that this functions more like an SINT with
possible values 0 and 255,
and use an AI or AO record for it.
Maybe an AO record linked to a BO record.


Navigate by Date:
Prev: Re: Scaling Database entries Andrew Johnson
Next: the body. No never should Khayman smile as he of Rodney Sullivan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Irmis applicative points Andrew Johnson
Next: the body. No never should Khayman smile as he of Rodney Sullivan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024