LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenate an analog signal to a serial code

I'm trying to incorporate a temperature measurement into a fairly complex code provided by "AALBORG LabVIEW Integration for XFM instruments," and I don't know how to approach it. In the default event structure, I added a simple temperature reading using DAQmx blocks, but I don't know how to connect it to the rest of the code. The temperature reading is an analog signal, while the rest of the code is serial. Any small help is appreciated.

0 Kudos
Message 1 of 7
(178 Views)

Hi Jousepa,

 


@Jousepa wrote:

I'm trying to incorporate a temperature measurement into a fairly complex code provided by "AALBORG LabVIEW Integration for XFM instruments," and I don't know how to approach it. In the default event structure, I added a simple temperature reading using DAQmx blocks, but I don't know how to connect it to the rest of the code. 


That example isn't "complex", but it is "crowded and coded in a bad way"…

 

  1. Why is there a wait funciton inside the TimeOut event? (Event cases should be executed as fast as possible!)
  2. Why do you set a sample rate of 1S/s for the temperature reading while the TimeOut event is set to execute after 50ms?
  3. Why do you use the "N samples" mode for DAQmxRead without specific the number of samples to read? (This interferes with item 2!)
  4. Why is there no label for your chart? NEVER delete labels of frontpanel elements! (You may hide them in the frontpanel…)
  5. Why are there so many "default if unwired" tunnels at your event structure? I guess you want to handle all those data more gracefully…

@Jousepa wrote:

The temperature reading is an analog signal, while the rest of the code is serial. 


The code is not "serial"…

The readings of that XFM device seems to be stored/managed by all those cluster, which contain mostly string elements. (Unfortunately you didn't attach all those subVIs so we cannot examine them!)

 

I recommend to hold the "data of interest" in your own data structure, all measurement data should be DBL and no string!

I also recommend to use that device driver only as an example and to build your own VI that does exactly what YOU need and not what the device manufacturer made as a bad example…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(158 Views)

The answers to your questions are simple — because I'm a beginner haha. I thought that if I was using VISA drivers, it was because the communication is serial, so I receive data in the form of strings (ASCII). The thing is, the code works perfectly for what I need, I just wanted to add other parameters. Thanks for the quick reply.

0 Kudos
Message 3 of 7
(144 Views)

Hi 

The code you shared is complex, and to be honest, this code should be redone, to decouple the event structure with the Data aquisition. 

 

But considering that the code is running, you did right in adding the read daq on Case 5 of the Timeout Event Structure. 

You wrote you don't know how to connect it to the rest of the code. 

 

What are you trying to accomplish and where are you stuck ? 

For example, If you want to save the temp data into the same file, you can wire the array outtput into a vi that converts the array of numbers into string before it is saved on the file. 

 

LVNinja_0-1753717290675.png

 

Message 4 of 7
(142 Views)

The subVIs are in the zip file — I'm not sure if you can already view them like that. I'm stuck when trying to combine that data into the same file (like a Notepad file), so I don't end up with two separate ones. First I tried to convert it into a string. I tried connecting it in several places, but I kept getting errors with the number of elements in the clusters, etc.

0 Kudos
Message 5 of 7
(126 Views)

Hi Jousepa,

 


@Jousepa wrote:

The subVIs are in the zip file — I'm not sure if you can already view them like that.


Thanks for posting them.

They are in the same bad shape as your main VI…

 

I hope you already use a LabVIEW project file to organize your LabVIEW project!?

 


@Jousepa wrote:

I'm stuck when trying to combine that data into the same file (like a Notepad file), so I don't end up with two separate ones. 


You already know how to write (string) data into a text file.

You know how to convert numeric data to string and vice versa.

Why not combine your knowledge to add one more subVI to write your temperature data into the same text file?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(109 Views)

This is what I’ve done, but I haven’t been able to test it in practice, so I have no idea if it will work.

How do you recommend I test without real hardware using instrumentation that is not from NI?

 

Regards.

 

 

0 Kudos
Message 7 of 7
(58 Views)