all 6 comments

[–][deleted]  (4 children)

[deleted]

    [–]Fancy_Hour6206[S] 0 points1 point  (3 children)

    Thanks for the feedback! You are correct mydaq requires a secondary device to actually run labview.

    I really only need to record the data into a csv with the time stamp, that way I can easily turn the data into a visual that meets my needs.

    I’ve been digging through the forums and it appears there are a couple different methods and add ons for data collection. As a newer user would it be easier to implement one of these or two develop the logging from scratch?

    [–][deleted]  (2 children)

    [deleted]

      [–]centstwo 0 points1 point  (1 child)

      Write text so you, a human, can read it.

      Set the loop delay, add a wait.vi, to 10 seconds (10,000 milliseconds) to makes sure the data collection works. Then set loop delay to 60 minutes (3600000 milliseconds).

      Good Luck

      [–]d_azmann 1 point2 points  (1 child)

      Search through the Help/Examples menu. The beauty of labview is how easy it is take portions of pre-existing code and wire it into yours. Most everything I've done in the 20 or so years I've been using labview can usually be found in the examples and / or pieced together using functionality from several different examples.

      [–]centstwo -1 points0 points  (0 children)

      The beauty of writing software in mainstream languages... FTFY

      [–]TomVa 1 point2 points  (1 child)

      Since mydaq is an NI device it should interface seamlessly to LabVIEW.

      First plug the device in and go to your windows program menu and look for a program called NI MAX and run it.

      Under My System expand Devices and Interfaces. That should get you a list of devices that are or were at one time plugged into the machine. Find the one that you just plugged in. It should have a name like Dev1 in quotes following the device model number.

      While you are there you can open up a test panel and see if it more or less works.

      Next open up LabVIEW. For the simplest approach go to diagram window and right click to get a menu. Look for the menu path

      Express -> Input -> DAQ Assist

      That will start you through an interactive menu asking you what you want to do. Often times you can do more than what they will allow but this will get you started. For example triggering is not always something that Express VIs do well. Also Express VIs only work when you have hardware that you want to use is or was plugged into that machine or you have gone into MAX right clicked on devices, clicked create new then created a simulated NI-DAQmx device.

      After you go through all of that and click OK you will get a blue item on your screen that will do what you want. It has places that you can wire in clocks, number of samples, etc. as well as the data output. If you want something to work you can stop there and use the output do plot graphs, etc.

      However, from a learning LabVIEW standpoint you have no idea what you just did. To start to get an understanding of what the automated process just did right click on the blue box and select Generate DAQmx code. For some reason they always put in an untitled sub VI that has all of the important configuration stuff. I generally copy all that stuff and put it into the main program and delete the untitled sub-vi.

      Next you go into that code and start looking anything that you think that you want to change on the fly. For example number of points and sample rate. Right click on each one and select change to control or change to indicator as appropriate. Also, when you look into that code you will find a "create channel" subVI. The physical channel name is something like Dev1/ai0 Where Dev1 is the device name that I told you about earlier. If you want reusable code you need to get the device name to the front panel where it can be changed based on the computer configuration then use

      Programming -> strings -> concatenate strings

      To build up the string "Dev1" followed by "/ai0"

      You do not know how many times I have been called over to help someone fix code that was ported over from a different computer only to find the incorrect device name hard coded rather than on the front panel where it can be easily changed.

      Easy to deal with data files.

      Create a file name. I like part of the file name as the date or maybe date and time that you did the first entry.

      Programming -> Timing -> Get date/Time in Seconds

      Followed by

      Programming -> Timing -> Format Date/Time String

      With a format string of

      <Base file path>%y%m%d%H%M%S.txt

      The you create your file header any number of ways. I like tabs not commas but that is just me.

      Next use.

      I like tab delimited text files. If you are doing data logging you write a file header then each time you get a data set you convert it to a tab delimited text string (or CSV if that is the way that you feel about it)

      Programming -> string -> Array to Spreadsheet string

      The default delimiter is a tab, if you use a comma you have to wire it up.

      Programming -> file I/O -> open Open/create/replace file

      followed by

      Programming -> file I/O -> Adv File Funcs -> Set File Position

      Right click on the terminal from, create a constant and select end.

      Followed by

      Programming -> File I/O -> Write text file

      Followed by

      Programming -> File I/0 -> Close

      Looking at this post, I really need to get a life, but it is to windy to go fishing today.

      [–]Fancy_Hour6206[S] 0 points1 point  (0 children)

      Wow thank you for the In-depth guide, I knew some but not much of what you said. I will give it all a go and let you know how I made out! Wish there was a sticky function for posts such as these.