LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing an indicator value using an event structure

Solved!
Go to solution

Greetings,

 

I have counter trigger by an external instrument, but this one resets every certain time which I cannot change. So I'm trying to store the number of trigger in a different indicator using a an event structure and the value change of the previous indicator (Event counterere). My idea is that each time the value changes the new counter (Event counter) should add 1 but  running the program keeps the value in zero always.

 

Thank  you,

R. Monarrez

Download All
0 Kudos
Message 1 of 14
(1,948 Views)

Hi roberto,

 

some notes:

- the LabVIEW help describes when an event is triggered. Did you read this?

- the value in the shift register will stay at zero forever as long as you only add zero to it…

- the value in the shift register will also not increment when the code handling your device will only run once…

 

Your code:

check.png

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 14
(1,931 Views)

(On phone, can only look at picture)

 

99% of your code makes no sense at all.

The indicator belongs inside the loop

The result of 0+1 is always the same

Indicators don't fire events (except with Val(sgnl)).


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 3 of 14
(1,929 Views)

Please use Block Diagram Cleanup.

 

Your Event "Counterere" is an indicator.  So there is no user interaction that would trigger a value change.  And there is no Value Signalling property node to programmatically fire the event.

 

Even if it did run, Event Counter (with proper spelling) will only be updated when that while loop ends.

 

Gerd already pointed out things about +0 and your device code only executing once.

 

I would recommend you learn more about LabVIEW from here. How to Learn LV

0 Kudos
Message 4 of 14
(1,925 Views)

Hi.

Since you pointed out that I cannot use an event structure with an indicator, I change the code to the following. But while the counter goes up, it doesn't count properly when comparing it to the external counter plug into the same trigger, after a while the Labview counter is always behind the actual number of events that have occur, not sure if this is  related to the way the feedback works.

 

Thank you.

0 Kudos
Message 5 of 14
(1,843 Views)

Sounds more like your application is not keeping up with the pulses.  This is common in software.  That is why we rely on the hardware to keep track of the number of pulses have occurred.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 14
(1,833 Views)

Hi roberto,

 

I would guess your VI is too slow because of all those bended wires in it.

This way tha data cannot flow as fast as it needs to!

😄

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 7 of 14
(1,814 Views)

@robertomp09 wrote:

Since you pointed out that I cannot use an event structure with an indicator, I change the code to the following.


You need to stop attaching meaningless truncated pictures and show us the entire code instead. In your first VI, the "instrument IO train" is a single shot, starting with the configuration and closing at the end. Are you using "continuous run" mode to run all this?

 

We don't have your instrument subVIs. What do they all do? Please explain in detail how everything is connected, how you are running it, what you expect to get, and what you get instead.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 14
(1,809 Views)

Here is the full VI, the subVIs are provided as part of the instrument, I attach a .zip with all the libraries and the subVI, the instrument is a VME TDC wired using a USB bridge, the instrument works since I have tested it using a C program, but I need a DAQ using Labview.

 

Right now I'm trying to get the event counter working, but the provided counter (Labeled 'Event counterer') reset every few events, since I need to keep track of this, I did what is shown in the previous screenshot, which does go up most of the time according to the external counter, but after a while the Labview counter starts to get behind, since the LED does turn on  after every event, I'm not sure why the counter doesnt count certain events.

Download All
0 Kudos
Message 9 of 14
(1,802 Views)

So where is the loop that keeps this thing running?  As it is right now, this runs in a single shot initializing, setting channels, getting events, then closing out.  You are only going to get 1 count (if circumstances are right) when this VI runs.

0 Kudos
Message 10 of 14
(1,786 Views)