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.
Solved! Go to Solution.
- 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…
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
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.
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.
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!
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.
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.
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.