Showing results for 
Search instead for 
Did you mean: 

Save data to one file instead of multiple

Go to solution
Accepted by topic author DP123

I have added the serial part to the VI. I do not have that serial parameters typdef cluster, but your PC should have it, so you should be able to run the VI. Note the following changes: it is not elegant, but I used a local variable to transfer data from the serial loop to the Consumer one. I set the iteration speed of the serial loop to 2 Hz, and since the rate of the Consumer is 1 Hz, it should get always te "most recent" serial data. I guess you do not need tight sync, so this should be ok. Another thing is that, you do not need a second "stop" button for this serial loop, I just use there the "Get Queue Status" function to see when the top loops are stopped.

Try it, I hope it will work for you. Besides, if you really want to understand how this VI works, I recommend to take some training, like the Core 1-2 "self-paced" learning videos:

Good luck!



Message 21 of 27

Hey Blokk


Thanks alot Blokk. Sorry for not responding ealier. I have had some things I had to sort out today and I will be able to test the VI tomorrow.

I guess I do not need a really tight sync and that will work for me.

I have one of the sensors at home the CO2 sensor and tried to run that one independently but I receive an error.

I have an idea that it might be because the "Get Queue Status" from the top loop stops the VI because no data is received. Could that be it? 

I also receive another message when I load the VI which I do not completely understand. I have attached the two error messages. 


Once again. What you have done I really appreciate alot! 




Download All
0 Kudos
Message 22 of 27

The error msg is clear: you specify hardware resource what is not available. Open MAX, and check what are the physical resources you need to specify for the 4 DAQmx tasks. What you say does not make sense to me: how can you try to "run independently" a sensor? The VI will only work if all the 4 hw resources are available! If any of the modules are missing physically from the cDAQ chassis, or their slot number or the chassis number changed, you will get this error. Read those error msgs!

0 Kudos
Message 23 of 27

Just to repeat again: the VI will only work, if the 4 cDAQ modules are connected to the PC, plus the serial device via the com port. Why do you expect the VI work if it is not programmed in that way? See the top loop, and imagine what happens when hw is not present. I advice you to go through the Core 1-2 learning material, you will see many things will become clear...

0 Kudos
Message 24 of 27

The CO2 sensor is connected through USB and not like the rest of the sensors which are connected to the cDAQ chassis / modules. The reason why I was wondering is because in the VI I made I was able to run serial port code made for the CO2 without the rest of the sensors without getting an error. 


Yes, I will definitely get some lessons. I know that I am lacking alot of knowledge. 




0 Kudos
Message 25 of 27

You did not tell me that it is required to be able to run the serial loop independently. If so, as a simple workaround, just delete that Get queue status function from the serial loop, and create a second stop button for this loop, as before.

If you learn LV further in the future, you will see how elegantly can be programmed such features using a State Machine. In that case you can reinitialize hw during runtime, etc...


edit: and just to ask: you have a co2 or a CO sensor? CO is carbonmonoxide, CO2 is carbondioxide. Just because you are using both wordings...

0 Kudos
Message 26 of 27

I do not need to run the serial loop independently it was just because I have that sensor at home so I tried testing it. When everything is set up I will have all sensor connected at the same time. 

I have two sensors. One for measuring CO2 and one for measuring CO. That was another thing I noticed. I tried deleting Get queue status function and I was getting the same reading from the CO2 sensor on both the chart for CO2 and for CO. 


edit: I added a picture of the CO2 sensor just so you could see it:)




0 Kudos
Message 27 of 27