LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the write to measurement vi to log data every second or every 10 seconds?

Hey

 

I have been trying to look it up for so long and I can not seem to find any help to this problem. I can log my data but I want the user to be able to choose how often the data is logged. If they want it to be logged every second or every 10 seconds. I use express vi's so I know it is the "wrong way" to code but I am still trying to learn.

 

DP

0 Kudos
Message 1 of 6
(1,540 Views)

Hey

 

I have been trying to look it up for so long and I can not seem to find any help to this problem. I can log my data but I want the user to be able to choose how often the data is logged. If they want it to be logged every second or every 10 seconds. I use express vi's so I know it is the "wrong way" to code but I am still trying to learn.

 

DP

Download All
0 Kudos
Message 2 of 6
(1,538 Views)

Yes, you should not use Express VIs. You can see many examples using binary, text and TDMS file handling. You can see these examples via the Help menu point.

 

Regarding to the logging frequency, use a modulo devision along with a Case structure. In this case of course you need to know the timing of your loop. I show an example here with a loop which iterates at 1 Hz:

 

filesave.png

 

The next step in your learning curve should be the State Machine. Using a state machine, you can give the user more options, like start and stop file record, DAQ task, etc...

 

 

0 Kudos
Message 3 of 6
(1,536 Views)

Hey Blokk

 

I have a hard time understanding what is going on in that piece of code you attached. It would really help if you could show me how to implement a solution inside my code so I could see it working aswell. Maybe I am asking for too much but as a new guy with no youtube video or anything showing an example it is really hard. I really appreciate your help. Right now my data is written every 0.010 seconds which is really over the top.

 

DP

0 Kudos
Message 4 of 6
(1,521 Views)

You have a rate of 1000 Hz and samples 100 for your DAQ Assistant. It means it executes in every 0.1 sec. This is the while loop iteration time. So if you want to log data at every 1 sec, you need to use a value of 10 for the modulo devision as devider, see my example VI and implement it for your VI. If you do not understand the VI how it works, you should really go through the basics. If you are a student, or you have LV licence, you can access the Core 1-2-3 teaching videos. Besides, I do not want to make your home-work for you 😉

 

Another thing is that useless DAQ Assistant express VI. You should also learn how to use proper DAQmx functions, so you could get rid of that Express VI, and its evil sidekick the dynamic data wire 🙂

So you want to measure 2 K-type thermocouples and a current, using a cDAQ device, yes? There are lots of examples via the help menu where you can see how to program using low level DAQmx functions...

0 Kudos
Message 5 of 6
(1,509 Views)

Hi Blokk

 

I can not make it work :(. I am trying to understand but it is not that easy. How do I finish the VI I attached? 

 

DP

0 Kudos
Message 6 of 6
(1,429 Views)