LucSnijers
Member
Hi all,
( i use Siemens S7)
I'm writing code to calculate a totalizer: a trigger adds a value to a counter, the counter is written to a DB, where it is read by the HMI. The counter cycles at 1000000. The value is historised and used for shift reports.
My question is where you prefer to persist the total value?
A. As a Static variable in the FB
>> The FB writes the value as an OUT parameter.
>> The DB/HMI value is always overwritten by the FB.
>> When you update the FB, the totalizer is reset.
B. In the DB / HMI tag
>> The FB reads and writes the values as an IN_OUT parameter.
>> When the FB is updated, it uses the DB value to continue the count.
>> When the DB is updated, the totalizer value is lost.
thanks, Luc
( i use Siemens S7)
I'm writing code to calculate a totalizer: a trigger adds a value to a counter, the counter is written to a DB, where it is read by the HMI. The counter cycles at 1000000. The value is historised and used for shift reports.
My question is where you prefer to persist the total value?
A. As a Static variable in the FB
>> The FB writes the value as an OUT parameter.
>> The DB/HMI value is always overwritten by the FB.
>> When you update the FB, the totalizer is reset.
B. In the DB / HMI tag
>> The FB reads and writes the values as an IN_OUT parameter.
>> When the FB is updated, it uses the DB value to continue the count.
>> When the DB is updated, the totalizer value is lost.
thanks, Luc