Continuously measure and write waveform using tdms

Hello everyone,
I am doing my thesis using Labview 2010(since it is only version avaliable in University currently ). I need to read and record data from microphone(currently using simulate signal since i need to make program work first) then save and analise it(didn't reach that point yet). I tried to use event structure so i can record and then read tdms file. But unfortunatly it records only small piece, then i inserted while loop so it will record continuosly but program doesnt respond after i push record and i can only close it manualy from toolbar. Please could anyone help me or suggest something since i am not very good at Labview and any feedback is welcome. Here is what i have done till now. I tried to search forums for some similar solution but could not find anything usefull(some had much newer version so i could not open). Thank you.
Solved!
Go to Solution.
Attachments:
test2.vi ‏45 KB

Hi and welcome to the forums,
The reason you cannot stop the recording of the waveform or exit the application is because you have the event case configured to "lock panel until the case for this event completes" (in edit events). This means that LabVIEW will not respond to user interaction until that event structure completes but because you rely on being able to press the while loop stop button to finish the event structure means you have a deadlock and have to abort the VI.
The architecture of your application is not ideal - I would strong advise against having anything that takes a long time to execute inside your event structure for the very reason above (obviously you can untick lock panel as a quick solution). I would suggest having a look at the producer/consumer design pattern (events) (new... > from template > frameworks) as this would be more appropriate for your application. You can handle your button presses in the top event structure and have a state machine in the bottom loop for starting, running and stopping your data acquisition.
The idea is that you only do very little inside the event structure so it frees up the front panel but the messages (e.g. start/stop acquiring data, exit application) are handled by another loop.
I don't know if it ships in LabVIEW 2010, but in 2012/2013 there are sample projects that include a "continuous measurement and logging" project which might be suited to your application. There are also examples for state machines and queued message handlers.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets

Similar Messages

  • Video Playback Problem with Developer Walkthrough of the Continuous Measurement and Logging Sample Project

    Hi!
    I have serious problems playing the video Developer Walkthrough of the Continuous Measurement and Logging Sample Project.
    As the video pauses every few seconds for buffering. I am not able to watch it. Just wanted to check if you can playback the video:
    http://zone.ni.com/wv/app/doc/p/id/wv-3401
    This happens on any browser (chrome, ie, firefox). I am using Win XP and the latest Adobe Flash Player. About 2 weeks ago NI Germany confirmed the problem and promised to contact NI USA as they are responsible for these videos. So far nothing happened. In the meantime I received an e-mail that the problem could not be confirmed although they had confirmed it before...
    Thank you for any feedback.
    Regards,
    Anguel

    Hello ctVolFan,
    As indicated in the "support" section of the SPOT, you should get in touch with self-paced-training(at)ni(dot)com.  I don't believe that team monitors these forums directly.
    Regards,
    Tom L.

  • Developer walkthrough fails on Continuous MEasurment and Logging

    I am having problems watching these two videos:
    Developer Walkthrough of the Continuous Measurement and Logging Sample Project
    http://www.ni.com/video/2741/en/
    Developer Walkthrough of the Continuous Measurement and Logging Sample Project
    Queued Message Handler Template Documentation
    http://www.ni.com/video/2728/en/
    It gets stuck at the start saying Slide 1/1: Buffering.
    I have downloaded the latest Adobe flash.  A guy from NI support rang in response to my question to them and said that it worked on Chrome for him.  I tried that and they don't work for me.
    Can anyone help?

    OK, one update from my side:
    On my machine (Win7, 64bit) it is working when running Firefox 29.
    Using IE9, the link to the video seems to lead back to its page, no popup, nothing.
    Point is, that my IE (since IE8) is obviously not 100% compatibel with Adobe Flash player. For instance, i have issues to play videos from YouTube on the machine using IE (error messages like Flash not installed or simply a blank screen instead of the video) but not for all videos there. With Firefox, i can view all videos from YouTube except the ones which are prohibited from YouTube due to national restrictions ("This video is forbidden in your country" or something like that).
    So all in all, it seems to me that the issues you all observe are issues between the browsers and Flash, invalid settings for popup-blockers and specific "error handling" of specific browsers (which create the "loop-link-behavior").
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How best to modify Continuous Measurement and Logging project

    Hi,
    I'm looking to log and aquire continuous data from some devices, and it looks like the Continuous Measurement and Logging project template is a great place to start... but I need to log/acquire from upwards of 20+ devices...
    What's the best way to go about making this template more scalable?
    Thanks

    Yes the CM&L project template is a good framework to hang your code on .
    (You find it with "Create Project" in 2012 and later versions)
    The developer walk through is useful for the first time getting into the project.
    With 20 devices I have to ask what kind of throughput are you talking about here?
    Jeff

  • Continuous Measurement and Logging Template - May hang-up due to lost Exit

    The template Continuous Measurement and Logging in LabVIEW 2012SP1 has a flaw in the both the Acquisition and Logging loops.
    The Stop message handler discards all messages in the message queue. The note says:
    "Stop - Flush the queue of any pending "Log" messages. Close the TDMS file reference." See picture below.
    This concept breaks if the Exit message is posted while the Stop message is being processed. The Critical time gap for this to happen is small because Exit is posted to the front of the queue. But it depends on the processing in the Stop handler case. Small or large - it can happen.
    The symptom is that the application hangs in an infinite wait on the message queue - all controls are with no effect as the rest of the loops are terminated. Only Break will terminate the application. Pause button does not work either. (see this forum entry)
    This problem may only appear after the application has become more complex and the timing has changed - the fresly made template works and does not reveal the issue.
    The cure: First I thought of previewing the queue elements before discarding them selectively, one by one in the Stop loop, but that wont work either, because the Exit may arrive precicely in the time laps between preview and dequeue - remember Exits are posted to the front of the queue.
    I think the best option is to replace the flush of the queue in the Stop message handlers with a Selectively dequeue of messages one by one and check each if Exit is found - if so, re-insert it into the front of the queue. All other messages are discared. This look like this, having the interesting parts visible...
    Below is what the Stop message loop looks like with the problem highlighted.
    Given that I am not mistaken, I think it is better that NI updates the templates to prevent this problem.
    Solved!
    Go to Solution.

    Here's what the idle state case within the stop message case looks like:
    We don't hang the CPU handling a constant stream of no-op messages because we only enqueue "Log" messages when we are in the valid logging state (the Idle state here is again a passthrough).
    The worst case scenario is that there are number of Log requests already in the queue when the system stops. Upon recieving the Stop message the state transitions to idle and the remaining Log messages become no-ops due to the state.
    I will look into the feasibility of posting some updated VIs.
    ~Simon

  • Strain measurment and write to file with NI9237

    Hopefully this lab view VI can help some of the novices like myself to acquire strain using the NI9237 and write to a file.  The example VI available from NI "Cont Acq Strain Samples (with calibration)" is fine for sampling data and viewing on a chart, but you need to add your own elements if you want to logg data or write to a file.
    Since aquistion is continuous, reading and writing data must be done at discrete intervals rather than continuously, or, you will end up with a very large file that can not be easily handles in excel. Also, data gets acquired in "packets" of several samples for each channel, so even if you put a write function within a case structre, as I have done ,and you don't convert the data you get that whole "packet" every time the comand writes to file. Again, you will end up with a lot more data points than you would like.
    Though the top level VI is pretty simple, it took me some time and help from many folks for me to figure out what was going on.  I thought I would share.
    Thanks to Sandra T, Jarrod B, Kyle B, Marc A, Herbert E and Jesse O. for your help
    Next goal is to acquire voltage from a different Daq card, convert to load and graph and write load vs. displacement.
    hopefully the attached files are the correct method so the VI fuctions with its sub-VI's.  If not let me know.
    Regards,
    Alfonso
    A. Lopez
    Attachments:
    Cont Acq Strain-Qbridge-I-write to file-NI9237.vi ‏199 KB
    Measure Strain.llb ‏238 KB

    Alfonso,
    I'm glad you got your application running.  It is also nice that you are wanting to share your code.  NI is currently testing a new system that allows community members to share code.  If you like, you can also submit your code here.
    Regards,
    Jesse O.
    Applications Engineering
    National Instruments
    Jesse O. | National Instruments R&D

  • Is it possible to change the resolution of indivdual channels in measurement and automation explorer using a VI

    Hi
    I'm acquiring data on 8 analog input channels using a PCI-6052 E card. The data on channels 5 thru 8 is going to be between +1V and -1V. So for greater resolution I'm manually changing the range of these channels to +1V to -1V in the measurement and automation explorer. Is there a way by which I can make these changes directly using a VI ?
    Thanks,
    Shiv

    Hi
    Yes you can, but only if you use the "AI Config" VI. AI config allows different gains for different channels. The "channels" and "input limits" inputs of the VI accepts arrays. The first element of the input limits array corresponds to the first element of the channel array. Check the "cont acq&chart (buffered).vi" in the LV examples. There you see what I mean!
    Regards,
    Luca

  • How to read and write files using flex?

    Using flex, we would like to make some utility that will do a
    lot of reading and writing from local files.
    The writing is what I am more worried about. How is this
    possible?
    I want to make .zip files containing many xml files, and some
    assorted media files such as .swf jpeg, html, etc.
    I am new to flex btw, I've never used it properly before, and
    this is the main concern I have with flex, which is that it doesn't
    let me write and read lots of files.
    Mainly we are looking for a good cross platform solution that
    will let us develop an app, and flex looks professional and it is
    cross platform. The "internet app" side of things, isn't so much
    what we need really.
    Would wxWidgets be better suited to our needs?

    The Flash player sand box will not allow reading and writing
    local files. If you want to use Flex to create a desktop you will
    need the Apollo runtime. The alpha is available at Adobe
    Labs.

  • How to  read from excel file and write it using implicit jsp out object

    our code is as below:Please give us proper solution.
    we are reading from Excel file and writing in dynamicaly generated Excel file.it is writing but not as original excel sheet.we are using response.setContentType and response.setHeader for generating pop up for saveing the original file in to dynamically generated Excel file.
    <%@ page contentType="application/vnd.ms-excel" %>
    <%     
         //String dLoadFile = (String)request.getParameter("jspname1");
         String dLoadFile = "c:/purge_trns_nav.xls" ;
         File f = new File(dLoadFile);
         //set the content type(can be excel/word/powerpoint etc..)
         response.setContentType ("application/msexcel");
         //get the file name
         String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
         //set the header and also the Name by which user will be prompted to save
         response.setHeader ("Content-Disposition", "attachment;     filename="+name);
         //OPen an input stream to the file and post the file contents thru the
         //servlet output stream to the client m/c
              FileInputStream in = new FileInputStream(f);
              //ServletOutputStream outs = response.getOutputStream();
              int bit = 10;
              int i = 0;
              try {
                        while (bit >= 0) {
                        bit = in.read();
                        out.write(bit) ;
    } catch (IOException ioe) { ioe.printStackTrace(System.out); }
              out.flush();
    out.close();
    in.close();     
    %>

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

  • I want to run my program with continuous aquisition and write data to file when a button is pressed and get the most recent samples from the DAQ board.

    This is an update to a question I asked earlier. I am still trying to solve the problem. I have included a zip file with a library file. The file to open in pj_pushbutton.vi. I have placed comments explaining the issues and problems in this vi and the subvi's.
    When I push my button to write the data to file I think it is writing the data that has already been stored in the buffer and writing to file all at once. I want the data that is taken from the DAQ board from the time that I press the Write File button. How do I do this?
    Attachments:
    pj_pushbutton.zip ‏692 KB

    Hi,
    1. In AI read, you need to set the Read/Search option to "Relative to End of Data".
    2. Next you should not start AI Read VI until you press the Write to File. I am attaching an example VI below. Please see if it helps.
    Regards,
    Sastry V
    applications Engineer
    National Instruments
    Attachments:
    MostRecentAcquiredData.vi ‏97 KB

  • Continuous Measurement and Logging LV2014

    Hello,
    I am examining the CML template which can be found in LabView 2014. It is very nice, I learn a lot just by playing with this template. However, due to the very minimal documentation (practically zero), some things are not clear why are there implemented?
    1., In the UI Message Loop, the Case structure has a "Confirm Quit" case. As I see, this case never can get triggered, since the stop button is disabled during DAQ, why is it there? I guess for to give an example, if someone wants to enable the option shutting down the app during DAQ, without stopping the DAQ?
    2., Since it is not explained in the documentation, could someone explain the behaviour of the enum type def in the UI Message Loop? I think I understand that, before stopping the DAQ, we have to be sure about first the DAQ is stopped. Second, all the data is logged, so the logging loop can be also stopped, and finally we can go to Idle state and "update status" message can be broadcasted. Am I right? Somehow it is still a bit "fuzzy" for me...
    thanks for help!
    Regards,
    Solved!
    Go to Solution.

    crossrulz wrote:
    I don't even put Stop buttons on my programs.  Almost always, somebody who was not familiar with programming LabVIEW would use the 'X' to close the window.  So when I discovered the Panel Close? event, I was overjoyed.
    yep, actually the problem is not that the user uses the X or a "stop" button, but that, we let the user to be able to quit the application without first stopping the DAQ. Would not be just easier to fire a pop-up dialog, telling the user, "hey, first stop the DAQ before you quit!" ? So some state-check could be avoided in the UI Msg loop`s case structure...
    2.: May I ask a CML related additional question? If I wish to extend the template with another DAQ loop, which has a different rate, or a loop which controls for example a flow controller, how would you do it nicely? Of course we create additional queues (notifiers too if we need graph plotting), etc. but how do you implement the state machine for this new loop? I think we need a separate enum typdef in the UI msg loop, since we need total decoupling between the DAQ and DAQ2 loops? Is that correct, or is there another way to do it? Maybe more compact if we create a cluster typedef, and we put the enumtypdef1 and enumtypdef2 in it, and we unbundle by name them only in the corresponding cases?

  • LabView 2012 Continuous Measurement and Logging (DAQmx) Project

    I've been working with this example to try to build a DAQmx and Serial acquisition message handling loops, as well as another message handling loop with two analog outputs for control. This control would also be based off of information from the DAQmx acquistion loop. Is this example appropriate to do this with? I've added two additional message handling loops (Serial and the AO control loop). I worried that this example might not be the best to follow.
    Attachments:
    Main.vi ‏108 KB

    I'm not sure what example you are talking about but it seems like you are wanting something like the document below.
    http://www.ni.com/white-paper/14119/en
    Carl W.
    Applications Engineering
    National Instruments

  • Logging Data using TDMS

    Hey peope of the world, I have a question about how to use the TDMS write function. I have never used this form of file I/O and even still I'm not very good at even using write to spreadhseet functions. My attached project is based of the continuous measurement and logging template, and I know that they use TDMS in their program. My only issue is I dont quite understand what all theyre doing and quite frankly I dont believe my program requires such detail in the logging loop. I have a logging loop setup with a open/write/close TDMS functions connected, but I'm pretty positive im doing it wrong. Any suggestions/feedback would be greatly appreciated, thank you!!!
    Attachments:
    DC Motor Dyno Test.zip ‏501 KB

    When you open a log from that test can you tell me when the log was started?  When was it stopped?  What computer was it ran on?  What user was logged in when it ran?  What is the time between samples, or sample rate?  Did the test end due to an error?  Or what was the test end reason?  What was the settings to the test?  Meaning what was the selected current, voltage, or loads?  What was the UUT type?  What was the UUT serial number?  And I just realized what is the name of the data you recorded?
    TDMS allows for properties to be set, which can be like meta data.  Information about the data that can help you understand more about how the data was taken.  This information is very useful in helping to understand an event that likely took place when someone wasn't around to see what happened.
    To set properties use the TDMS Set Properties.  If you give no group or channel name then the property is set on the file which will probably be fine for all the settings I mentioned.
    Another thing is I highly recommend giving a Group name and Channel name to the data being logged.  I actually thought the write VI had these terminals as required.  Without it I have no idea what the data even is.  Is it a pressure sensor? Is it in Voltage, or Current?  Is it RPM?  Is it Analog 0 or Analog 1?  These types of things can be better understood with a channel name, and properties of the channel.
    Oh and if your index file is too big at the end (it should be on the order of a few kb) then use a TDMS defrag on the file after the close to save space. 
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How well does mac read and write with FAT32

    Hi there,
    I have heard that an external hard drive formatted in FAT32 from a windows machine will work with a mac. Is it a seemless read and write while using an application. i have both a pc and a mac and want both to use the same harddrive.
    Thanks,
    WayneAdams

    Hi,
    as brianking said, you won't be able to boot from it, but for an external drive fat32 works like a charm. I share three 250 GB external drives with my colleagues at work and we only once had a problem of destroyed FAT which might have been caused by the Mac, but was never examined since it did not happen again.
    volker

  • File Read and write in Flex

    hi,
    can any one tell me how to read and write a file using
    actionscript in flex2
    regards,
    Shah Mohamed

    Hi all,
    I have tried read and write file using AIR inturn in Flex 3
    .I can able to compile it with no errors. But while i try to run
    ,it throw an error .and the stack trace of the error is below.. Im
    in showstopper stage. kindly update me with your suggesstions .
    Expecting the reply..
    Thanks in advance
    VerifyError: Error #1014: Class flash.filesystem::FileStream
    could not
    be found.
    at [newclass]
    at
    global$init()[D:\dev\nexxus\metasoft\iGallery;com\metasoft\flex\util;MetasoftUtils.as:8]
    at
    com.metasoft.flex.server::MetasoftServer/getUserInfo()[D:\dev\nexxus\metasoft\iGallery;co m\metasoft\flex\server;MetasoftServer.as:146]
    at
    com.metasoft.flex.server::MetasoftServer/isValidUser()[D:\dev\nexxus\metasoft\iGallery;co m\metasoft\flex\server;MetasoftServer.as:17]
    at
    components::Login/components:Login::login()[D:\dev\nexxus\metasoft\iGallery;components;Lo gin.mxml:14]
    at
    components::Login/__loginButton_click()[D:\dev\nexxus\metasoft\iGallery;components;Login. mxml:102]
    at [mouseEvent]
    regards,
    Shah Mohamed.N

Maybe you are looking for