Knowledgebase
* > eze System - Help Desk > Knowledgebase

Search help:


Counter value as input value

Solution

Each input on the ezeio has two registers; Value and Counter.

Both registers are displayed on the status page, and both are recorded when the input is configured for logging, but only the value register can be scaled to an engineering unit. The counter register is non-volatile, meaning it will keep its value even if the ezeio is reset or looses power.

When the input is configured as a Digital Pulse Input, the counter register will automatically count up with each pulse - so it acts as a totalizer for a flow/energy meter.

In this situation it can be useful to copy the counter to the value of a different input to scale or graph the data.

To achieve this, first set up a new input that will be our totaizer value, and set it as Hardware type : Special/Software.

We will need to use the script feature to copy the value from the counter to the new input.

The function GetInputCount( INPUT# ) fetches the counter value from an input.

The function SetInputValue( INPUT#, VALUE ) sets the value of an input (provided it is configured as Special/Software).

By combining these two function, and executing them inside the @Tick function once every second, we will get the desired result:

@Tick(uptime)
{
   SetInputValue( 8, GetInputCount(1) );
}

The above example reads the count value from input #1, and applies it to the value of input #8.

You can now work with the value on input 8 just as any other input - scale/convert, alarm or graph.

 

 
Was this article helpful? yes / no
Related articles Monitoring run time
Adding and subtracting input values
How does pulse inputs work?
Communicating input value to a different ezeio
Measuring 0-50V
Article details
Article ID: 4
Category: ezeio script programming
Rating (Votes): Article rated 2.3/5.0 (6)

 
« Go back