03-23-2018 11:09 AM
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
Solved! Go to Solution.
03-23-2018 12:06 PM - edited 03-23-2018 12:14 PM
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:
03-23-2018 12:07 PM - edited 03-23-2018 12:09 PM
(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)).
03-23-2018 12:12 PM
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
04-02-2018 08:29 AM
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.
04-02-2018 09:25 AM
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.
04-02-2018 11:28 AM - edited 04-02-2018 11:29 AM
04-02-2018 11:54 AM
@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.
04-02-2018 12:22 PM
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.
04-02-2018 08:22 PM
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.