From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Electronic comparator

Try "Get File Size" under File I/O > Adv(anced) File Functions.


GCentral
Message 11 of 45
(694 Views)

For the counter is OK.

For creating an other TDMS file, I  did what cbutcher said but I'm not sure if I did the right thing.

And, for reading the current tdms file in serial communication, t tried to use read tdms but it doesn't work. Can you plz see my file and tell me where are the mistakes. thank you

0 Kudos
Message 12 of 45
(690 Views)

A few brief comments:

  • Thank you for the credit, but it was RavensFan who provided the instruction on closing and opening the file.
  • In that case structure, you've wired the reference output to two different tunnels, one for each case. You need the to go to the same tunnel. You can see there is a problem because the box on the right side is not filled (it contains a kind of white square graphic)
  • If you want to send all of the data, it's probably better to create a subVI which converts your data to a string, a subVI which converts that string back into your data, and a subVI which takes your data and places it in a TDMS file. That way, you can run number 1 and 3 on the system acquiring the data, and 2 and 3 on the system receiving the data, and have a TDMS file on both systems without having to copy and paste the code
  • I'm not sure why you're dividing the count values by 2. Perhaps there's a reason, but I don't quite follow it. I also needed much larger width values with simulated (noisy) data, but maybe your data is much cleaner and 3 is enough.
  • In terms of actually sending the data, I'd recommend taking a look at clusters. There's what I can't say is a great tutorial, but at least a starting point for clusters here: Tutorial: Arrays and Clusters. The cluster information starts about half way down. If you define your cluster as a "typedef" and save that file too, then you can use it in your subVIs 1 and 2 as the input/output respectively (with strings as the output/input), and that might help you parse your data. Essentially I'm imagining a cluster containing two arrays of doubles (the data values and times), and perhaps then 3 scalar values (the count values - they don't need to be arrays for this part). Your subVI 3 can make them into arrays to log them in the TDMS if you're happy with the current layout.

GCentral
0 Kudos
Message 13 of 45
(632 Views)

It seems like from your private messages that maybe you'd prefer the counters to continuously increase (i.e. give the cumulative total, not the number in this iteration), so to do that you can add a shift register (one for each is probably simplest) and then use the Add node to increase as needed.

 

Something like this:

CumulativeCounter.png


GCentral
0 Kudos
Message 14 of 45
(627 Views)

For the counter, I devide by two because I would count number of times where data is above threshold. My signal is clean (generator signal) i change the witdh from 1 to 10 but always I have problem in detecting the threshold.

For serial communication i will do what you suggest and see what it will gives.

 

0 Kudos
Message 15 of 45
(626 Views)

And why the counter stops counting the thresholds values? It count just for the first miliseconds?

0 Kudos
Message 16 of 45
(630 Views)

for serial communication, I use putty on other computer, so no labview!! I can't use this conversion of tdms file

0 Kudos
Message 17 of 45
(615 Views)

What do you want the output on the other computer to look like?

Please give a detailed description with a (made up is fine) example, like:

 

i=0, countA = 0, countB = 0, countC = 0, meanVoltage = 1.213V
i=1, countA = 1, countB = 0, countC = 0, meanVoltage = 4.215V
i=2, countA = 1, countB = 1, countC = 1, meanVoltage = -3.213V
i=3, countA = 1, countB = 1, countC = 2, meanVoltage = 1.121V
i=4, countA = 2, countB = 1, countC = 2, meanVoltage = 5.213V
...

or similar.

 

Regarding your earlier post, what do you mean about the counts stopping working? Again, please be specific and describe exactly what you mean, or show screenshots if you believe it shows the problem clearly.

The continuous guessing as to what you want or mean just slows down the ability of others to provide sensible help/advice.


GCentral
0 Kudos
Message 18 of 45
(604 Views)

I would something like that, the indice_counter_increase is just extra.

For the counters, the signal is sinusoidal, I apply it for 5s and the counter counts just the threshold where were in the first milisecondes, I Know that by time indices of threshold. Normally, the counters should count the threshold until the final of acquisition because this threshold exists even after the first milisecondes(sinusoidal signa).

 

0 Kudos
Message 19 of 45
(600 Views)

Did you have any luck trying this?


@cbutcher wrote:

It seems like from your private messages that maybe you'd prefer the counters to continuously increase (i.e. give the cumulative total, not the number in this iteration), so to do that you can add a shift register (one for each is probably simplest) and then use the Add node to increase as needed.

 

Something like this:

CumulativeCounter.png


In particular, note that it's the "count" output that you're adding to the shift register, not the threshold value (and you need a Shift Register, not just a tunnel).


GCentral
0 Kudos
Message 20 of 45
(594 Views)