LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Taking difference of counter values on hourly basis

Solved!
Go to solution

Hello

 

i am reading counter value from PLC (no.of product produces) which increase once product is produced properly. i want to take difference of this value on hourly basisc show shows on labview front panel as the production per hour.

 

i am trying to do this by using shift register but stuck.

 

appriciate any idea 

 

thanks

asif 

 

 

 
 

 

0 Kudos
Message 1 of 10
(505 Views)

Your shift register is not initialized and contains a DBL while a counter is always an unsigned integer.

If you want it every hour, it is not obvious why you tap into the "seconds", which will be true about ten times every minute since you spinning at 100ms intervals. Your "indicator" will always show the exactly same value as the "control", which seems quite boring.

 

Can you attach your VI and explain where the counter value comes from? (For example, we cannot see what's in the other case)

 

Do you want to (1) start the timer when the program starts, then update every hour or (2) do you want to update when the hour value changes?

0 Kudos
Message 2 of 10
(476 Views)

Here's a very simple demo that can maybe give you some ideas...

 

 

0 Kudos
Message 3 of 10
(456 Views)

Thanks for your reply

 

just for simplicity...

 

Assume the value we can give from front panel as control (integer).. 

 

i want the value (difference ) at like 3PM,4PM,5PM etccc.

 

i want value difference between current value - values before 1 hour..

 

hope i made it clear

0 Kudos
Message 4 of 10
(440 Views)

So, what does the "value" represent and who changes it based on what? What are allowed values?

 

To get it to act differently when the hour changes, you would just compare current to previous hour and see if they differ (hint: shift register or feedback node). In the meantime, accumulate counts as I already showed.

 

Once you understand my code, it will be trivial to make suitable modification. Have you tried?

0 Kudos
Message 5 of 10
(424 Views)

thanks for replay

 

let me make it more simple to understand.

 

from front panel control i will give some inital value and later it will increased (it will be like counter value, integers)

just exclude the time function.   assume we have button on front panel. when ever i press the button the integer indicator shows be different from the inital value and when button is pressed. and then initial value becomes the value when button is press and after some time if i increase the value from front panel and then press the button and again i get the differnce of current and last buttone press value.

 

when i used the shift register it gives me always same value

 

thanks

asif 

0 Kudos
Message 6 of 10
(417 Views)

@Asif138 wrote:

when i used the shift register it gives me always same value 


 

Sorry, your description is way too ambiguous. Do you have some new code you could attach?

 

(There are millions of ways to use a shift register. What is "it"? "Same" as what?)

 

0 Kudos
Message 7 of 10
(392 Views)

Thanks

 

Please see the VI attached.

 

 

I want the difference between the the Boolean button press each time..

 

hope now its clear

0 Kudos
Message 8 of 10
(378 Views)
Solution
Accepted by topic author Asif138
  • You still don't initialize the shift register
  • You still use orange instead of blue for integers
  • Your boolean has the wrong mechanical action

 

See if this can give you some ideas....

 

takediff.png

 

(It seems attaching files is broken)

Message 9 of 10
(344 Views)

Many thank, 

 

i was not wiring the false case, once did its working....

 

rest i will do.

 

 

thanks

asif 

0 Kudos
Message 10 of 10
(318 Views)