We are creating a driver manager using the C# API and are trying to set status invalid, which is working through the SetSbit on HWObject, but it seems we have to SetData also. Is there a way of setting the status bit without updating the data for the hardware object?
If we do not call SetData the value is set to 0 when we call GetSlfPtr().ToDp(). Also if we call GetData for the HWObject we get 0 regardless of the real value.
Driver setting status bits only
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Driver setting status bits only
I had a look at the source code for the S7 driver which supports the feature to set the _invalid bit when the PLC connection is lost.
The code uses "setData" and "setSbit".
It looks like it works this way and not without using "setData".
Best Regards
Leopold Knipp
Senior Support Specialist
The code uses "setData" and "setSbit".
It looks like it works this way and not without using "setData".
Best Regards
Leopold Knipp
Senior Support Specialist
- adaneau
- Posts:310
- Joined: Tue Feb 21, 2012 9:49 am
Re: Driver setting status bits only
Hi,
I think this is normal because a change of bits should also trigger dpConnect functions (e.g. in case of connection loss), thus you need to use setData (and yes unfortunately I think it also change timestamp and value).
BR
Alex
I think this is normal because a change of bits should also trigger dpConnect functions (e.g. in case of connection loss), thus you need to use setData (and yes unfortunately I think it also change timestamp and value).
BR
Alex