LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to set up multiple data inputs from analog and serial devices, each have different data rates

Added in those changes, but the VI does not seem to work, the DAQ channels update crazy fast, and the serial connections just throw timeout errors, with an occasional blip of data that is mostly gibberish. How do I control the loop timing or is this automatic and there is something else wrong with the VI?

0 Kudos
Message 21 of 33
(1,733 Views)

How do you know you are getting timeout errors?  Did you put a probe or an indicator on the error wires?

 

What termination character are you using?  Your Serial Configures don't have one wired in, to the default of a linefeed is used.  But your VISA write in the bottom loop has a carriage return wired into the end of the command you are sending.  It is very unusual for a communication protocol to use a different termination character on its send vs. its receive.  So I'm guessing that you have one of them wrong.

0 Kudos
Message 22 of 33
(1,721 Views)

How do I get my data out of the case structure? What am I supposed to wire to the tunnels for the other cases when the Data type is HR vs TC for example? I want this to run in parallel so that everythign is writing at the same time. I was expecting for example since the TC case runs at once every 2 seconds (0.5Hz), that it would just write the same numebr over those 2 seconds while writing at 50Hz for the DAQ inputs. but I have all these empty tunnels and I am not sure what to do with them.

0 Kudos
Message 23 of 33
(1,706 Views)

LabVIEW12110,

Pictures of the case structure in question and a more in depth explanation of the aforementioned errors might help the community to assist on this one!

 

Thank You,

 

Brandon 

 

0 Kudos
Message 24 of 33
(1,686 Views)

Agreed that pictures of the newest version of the VI would help. In the last version posted there were no wires out of the case structure. I have two inefficient ideas for the question I think you might be asking.

 

I'm going out on a limb here and guessing that you're trying to store your data somehow now. If you really only need to populate outputs, you could use a local variable to call the current value in the front panel, or shift registers with the last value of each variable that are updated as new information becomes available. If this is done with the while loop you showed, however, it would generate a value for all variables whenever the value of any variable is dequeued. Depending on how long this will run, the number of data points could become unwieldy. Alternatively you could pass a NAN to each value not measured and then clean up the arrays later with a loop and case structure based on the the "is NAN?" operation. Like I said, two inefficient ideas. 

 

It would help to know exactly what you would like to do with the data outside of the case structure. 

0 Kudos
Message 25 of 33
(1,676 Views)

I am trying to write to TDMS like you suggest, but I get so many empty tunnels, what should I do with them? I want to write to a single file but if I do I get a 0 in the column every time it switches between cases in the data loop. Can I resolve this by giving up on the one file idea and just have separate queues and files for each different data rate? Or do I put in local variables everywhere there is any empty tunnel. Ideally I want the data to write the same number until a new number appears. So i fully expect the 1Hz one to have 50 of the same value while the 50Hz data rate to have 50 different numbers every second.

 

0 Kudos
Message 26 of 33
(1,666 Views)

You are making things way too difficult.  Put the TDMS write inside of each case of the logger loop.  You write only what you need to for each message you received.  You can add some additional code so that you go into a "No Log" case when you have the Write Data set to FALSE.



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
Message 27 of 33
(1,664 Views)

@crossrulz wrote:

You are making things way too difficult.  Put the TDMS write inside of each case of the logger loop.  You write only what you need to for each message you received.  You can add some additional code so that you go into a "No Log" case when you have the Write Data set to FALSE.


How do I wire it to make sure they all end up in the same file in the correct column without bundling them up first?

 

Also when you say you only write what you need to for each message, does that mean I will have a "0" or NaN in each cell whenever there isn't data? That is what I am trying to avoid.

 

 

0 Kudos
Message 28 of 33
(1,659 Views)

You are writing to a TDMS file.  So have a different group for each type of data you are collecting.  So you just write to a single group at a time.



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 29 of 33
(1,655 Views)

Is this mostly correct? I just realized I have them all going to the same group when they should have been separated. But other than that is this setup correctly? I want to be able to input markers in my data with the button press as well, and I need to record the time somehow. For some reason this does not record at 50Hz, it's more like it just records as quickly as possible...

0 Kudos
Message 30 of 33
(1,647 Views)