What is the best way to read high rate serial data?

My goal is to read 14 bytes of binary data from an instrument over RS232 serial (baud 460800) at 2000 Hz. I have not gotten a high speed serial card yet so I am currently using the standard serial port (115200 baud) and reading at 400 Hz. I configure the serial port, flush the buffer then enter a while loop to read the incoming data. I have a visa read 14 bytes per interation every 0.0025 seconds (400 Hz). However it seems the sensor is spitting out data faster than labview can read it because bytes are accumilating at the port. After a while the buffer fills up and the program fails.
Is there a better way to do this?
Would it be better to read larger amounts of data less often, e.g. like 1400 bytes every 0.25 seconds?
Thanks
Solved!
Go to Solution.
Attachments:
serial_read.jpg ‏161 KB
serial_read.vi ‏19 KB
bytes read.png ‏20 KB

Here is a producer consumer approach.... not tested
The unwrapping of the string could be done in a better way (didn't spend much time on it, not tested!! Just a quick mod from another post)
Can't remember what is faster scan from string or match pattern or regular expression .....
Avoid any frontpanel objects in the serial read loop to keep that thread independent from the GUI thread. Blocksize (128) should be optimized...
EDIT: The scan loop will not work   
Greetings from Germany
Henrik
LV since v3.1
“ground” is a convenient fantasy
'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
Attachments:
ProducerConsumerData 2.vi ‏29 KB

Similar Messages

  • What is the best way to read and manipulate large data in excel files and show them in Sharepoint

    Hi ,
    I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day.
    What is the best way to read the data form the excel file in fastest and most efficient way.
    2 nd Problem,
    I have one excel file that has many rows each row contain some data that has certain keywords.
    What I want is  to segregate the data of rows into respective sheets(tabs ) in the workbook.
    for example in rows have following data 
    1. Alfa
    2beta
    3 gama
    4beta
    5gama
    6gama
    7alfa
    in excel
    I want there to be 3 tabs now with each of the key words alfa beta and gamma.

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • What's the best way for reading this binary file?

    I've written a program that acquires data from a DAQmx card and writes it on a binary file (attached file and picture). The data that I'm acquiring comes from 8 channels, at 2.5MS/s for, at least, 5 seconds. What's the best way of reading this binary file, knowing that:
    -I'll need it also on graphics (only after acquiring)
    -I also need to see these values and use them later in Matlab.
    I've tried the "Array to Spreadsheet String", but LabView goes out of memory (even if I don't use all of the 8 channels, but only 1).
    LabView 8.6
    Solved!
    Go to Solution.
    Attachments:
    AcquireWrite02.vi ‏15 KB
    myvi.jpg ‏55 KB

    But my real problem, at least now, is how can I divide the information to get not only one graphic but eight?
    I can read the file, but I get this (with only two channels):
    So what I tried was, using a for loop, saving 250 elements in different arrays and then writing it to the .txt file. But it doesn't come right... I used 250 because that's what I got from the graphic: at each 250 points it plots the other channel.
    Am I missing something here? How should I treat the information coming from the binary file, if not the way I'm doing?
    (attached are the .vi files I'm using to save in the .txt format)
    (EDITED. I just saw that I was dividing my graph's data in 4 just before plotting it... so It isn't 250 but 1000 elements for each channel... Still, the problem has not been solved)
    Message Edited by Danigno on 11-17-2008 08:47 AM
    Attachments:
    mygraph.jpg ‏280 KB
    Read Binary File and Save as txt - 2 channels - with SetFilePosition.vi ‏14 KB
    Read Binary File and Save as txt - with SetFilePosition_b_save2files_with_array.vi ‏14 KB

  • What's the best way to read JSON data?

    Hi all;
    What is the best way to read in JSON data? And is the best way to use it once read in to turn it into XML and apply XPath?
    thanks - dave

    jtahlborn wrote:
    without having a better understanding of what your definition of "use it" is, this question is essentially unanswerable. Jackson is a fairly popular library for translating json to/from java objects. the json website provides a very basic library for parsing to/from xml. which one is the "best" depends on what you want to do with it.Good point. We have a reporting product ([www.windward.net|http://www.windward.net]) and we've had a number of people ask us for JSON support. But how complex the data is and what they want to pull is all over the place. The one thing that's commin is they generally want to pull down the JSON data, and then put specific items from that in the report.
    XML/XPath struck me as a good way to do this for a couple of reasons. First it seems to map well to the JSON data layout. Second it provides a known query language. Third, we have a really good XPath wizard and we could then use it for JSON also.
    ??? - thanks - dave

  • This community is great -- very helpful. What is the best way to read "word" docs on my brand new iPad 2? Is there an app for that?

    This community is great -- very helpful. What is the best way to read "word" docs on my brand new iPad 2? Is there an app for that?

    If you're just reading them from email attachments, you can just open it to "view" the document.
    However, if you wish to do editing and work, you'll need an application. I use Documents to Go, but there are other versions that people are happy with - do a search in the App store for "office suite" or "word processing".
    The next challenge is getting docs back and forth. Doc2Go and others have their own ways to physically sync docs when connected to a computer; you can also email changed/revised/new documents from the iPad to yourself. However, I use a "cloud service" called DropBox that stores docs in the cloud (so I can get to them anywhere) - I paid for the Premium version of Docs2Go to allow that kind of syncing.

  • I have a PPC iMac 10.4.11 and will shortly buy a new i Mac.  What is the best way to transfer all my HD date from old to new? Thank you!

    I have a PPC iMac 10.4.11 and will shortly buy a new i Mac.  What is the best way to transfer all my HD date from old to new? Thank you!

    Migrating from PPC Macs to Intel Macs:
    https://discussions.apple.com/docs/DOC-2295
    How to use Migration Assistant:
    http://support.apple.com/kb/HT4413?viewlocale=en_US
    http://support.apple.com/kb/TS1963
    Troubleshooting Firewire target disk mode:
    http://support.apple.com/kb/HT1661

  • My Mum( a pensioner) is wanting to purchase both an iPhone and iPad.  What is the best way for her to manage her data /calls/txt etc. obviously the cost needs to be as low as possible.  Currently does not have WiFi but uses dongle

    My Mum( a pensioner) is wanting to purchase both an iPhone and iPad.  What is the best way for her to manage her data /calls/txt etc. obviously the cost needs to be as low as possible.  Currently does not have WiFi but uses dongle

    My Mum( a pensioner) is wanting to purchase both an iPhone and iPad.  What is the best way for her to manage her data /calls/txt etc. obviously the cost needs to be as low as possible.  Currently does not have WiFi but uses dongle

  • What is the best way to transfer all of my data from my iPod touch 3rd generation to my iPhone 4s?

    I have a 3rd generation iPod touch, and now I am getting an iPhone 4s. What is the best way to transfer all of my data, including paid-for apps and music, from the iPod to the iPhone without losing anything? Can I just do it through iTunes or the iCloud? I have never used iCloud before.

    Follow the directions here:
    http://support.apple.com/kb/HT2109

  • What is the best way of reading a browser cookie and writing to sessionbean

    Hi,
    So far I have happily written a cookie in the visting browser and happily can display with a browser using a servlet println etc
    But what is the best way to take that value and put it into say getSessionBean1().setCookieValue("Cookievalue");
    I was thinking on the lines of calling a forward from the servlet "nexpage?cookievalue=stringetc".... or is there some nicer way?
    Thanks
    James

    In the page I simply referenced the facescontext directly... no need for a custom servlet.
    public void createcookie() {
    FacesContext fc = FacesContext.getCurrentInstance();
    HttpServletResponse resp = (HttpServletResponse)fc.getExternalContext().getResponse();
    Cookie userCookie = new Cookie("cookiename", "cookievalue");
    userCookie.setMaxAge(-1);
    userCookie.setMaxAge(3600);
    resp.addCookie(userCookie);
    return null;
    public String readcookie() {
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();
    Map cookiemap = ec.getRequestCookieMap();
    if (cookiemap != null) {
    Cookie cookie = (Cookie) cookiemap.get("cookievalue");
    return cookievalue;
    For reference I could not get getCookies() method of HttpServletRequest to work.. it would only return JSESSIONID.

  • What is the best way to keep high res when saving "for web"

    the files i'm saving for web so i can get them in jpg (or gif) format are coming out very pixelated.  this is when i print the image. 
    what is the best way to save for web an image and keep the resolution good. 
    using for a business card template.  avery template will let me attach images i want to the project.  to do this..  i "get file from computer" and it drops the image in but real small... then you are supposed to enlarge it onto your work however you want.  well when i enlarge this image file, it gets pixelated badly.  i'm thinking it's the way i'm saving it.  i do not adjust anything when i save.  maybe i should.  this is where i need guidance. 
    this is what avery template notes about the images i am allowed to use - When uploading the image, the maximum size allowed is 4 MB.  You can only upload JPG and PNG images either as RGB or CMYK.  so when you recommend things, can you please keep this in mind
    thank you for oyur time.

    Aida,
    When you save with the default template using save for web it is generally a very low settings.
    While in the save window you can define the pixel size of the image you want with quality as well as resolution too.
    Refer to tv.adobe.com video save for web or Adobe help file for detailed instructions.
    Mandhir

  • What is the best way to store and search 2D data

    Hi,
    There is a set of data (~10k records ) in 2D dimension.
    like this :
    Col 1, Col 2, Col3....
    What is the best way to store and search those records ?
    Thanks in advance
    Wilson

    Hi,
    Either userObjet[][] if you know how much data you have, and the data size is fixed, or use a list of lists. E.g. A Vector of Vectors (some will probably say that you should use an ArrayList instead, and that could be the case, but it sounds like you would want to display the data later on, and a DefaultTableModel (for JTables) uses a Vector as data holder).
    Kaj

  • What is the best way to write 10 channels of data each sampled at 4kHz to file?

    Hi everyone,
    I have developed a vi with about 8 AI channels and 2 AO channels... The vi uses a number of parallel while loops to acquire, process, and display continous data.. All data are read at 400 points per loop interation and all synchronously sampled at 4kHz...
    My questions is: Which is the best way of writing the data to file? The "Write Measurement To File.vi" or low-level "open/create file" and "close file" functions? From my understanding there are limitations with both approaches, which I have outlines below..
    The "Write Measurement To File.vi" is simple to use and closes the file after each interation so if the program crashes not all data would necessary be lost; however, the fact it closes and opens the file after each iteration consumes the processor and takes time... This may cause lags or data to be lost, which I absolutely do not want..
    The low-level "open/create file" and "close file" functions involves a bit more coding, but does not require the file to be closed/opened after each iteration; so processor consumption is reduced and associated lag due to continuous open/close operations will not occur.. However, if the program crashes while data is being acquired ALL data in the buffer yet to be written will be lost... This is risky to me...
    Does anyone have any comments or suggestions about which way I should go?... At the end of the day, I want to be able to start/stop the write to file process within a running while loop... To do this can the opn/create file and close file functions even be used (as they will need to be inside a while loop)?
    I think I am ok with the coding... Just the some help to clarify which direction I should go and the pros and cons for each...
    Regards,
    Jack
    Attachments:
    TMS [PXI] FINAL DONE.vi ‏338 KB

    One thing you have not mentioned is how you are consuming the data after you save it.  Your solution should be compatible with whatever software you are using at both ends.
    Your data rate (40kS/s) is relatively slow.  You can achieve it using just about any format from ASCII, to raw binary and TDMS, provided you keep your file open and close operations out of the write loop.  I would recommend a producer/consumer architecture to decouple the data collection from the data writing.  This may not be necessary at the low rates you are using, but it is good practice and would enable you to scale to hardware limited speeds.
    TDMS was designed for logging and is a safe format (<fullDisclosure> I am a National Instruments employee </fullDisclosure> ).  If you are worried about power failures, you should flush it after every write operation, since TDMS can buffer data and write it in larger chunks to give better performance and smaller file sizes.  This will make it slower, but should not be an issue at your write speeds.  Make sure you read up on the use of TDMS and how and when it buffers data so you can make sure your implementation does what you would like it to do.
    If you have further questions, let us know.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • What is the best way to re-install my apps data when changing the hard disk

    My MacBook (120Gb disk) is finally full and I have ordered a 500Gb disk to replace it.
    I am fine with changing over the disk but can anyone tell me the best way to reload all my apps and data from the present disk please?
    I have a Time Machine backup on a Network disk, a copy of SuperDuper and also my original 10.5 OSX install disks.
    Thanks

    Roger, since you have SuperDuper, I think the easiest thing to do would be to make a clone of your current hard drive to the new one when it arrives. You will need an external enclosure for the new drive; make sure it's formatted to Mac OS Extended (Journaled); Disk Utility will do this for you. Then connect that new drive via firewire or USB, and create the clone from your current drive using SuperDuper. Next, remove the internal drive from your Mac, insert the new drive and boot up. You can then place your older drive in the external enclosure to use for extra storage, though it won't be large enough to use as a cloned backup with SuperDuper.
    Good luck!

  • What is the best way to keep Drivers up to date?

    Hi Guys
    I am looking to keep a range of makes and models drivers up to date. I have done a bit of reading through a few blogs and wondering if DPInst.exe through a required task sequence is the best way?; if SCUP 2011 is useable?;
    or is there a better way?
    Thanking you in advance
    NN

    I have done a post on the subject myself. The blog is mainly for my own purpose, but I hope you get the basics of it:
    http://www.imab.dk/extending-hardware-inventory-in-sccm2012/
    Martin Bengtsson | www.imab.dk
    Thats very interesting, thanks you.
    NN
    Oh, you might need to know how to use regkeytomof, which is the tool that generates the .mof edits you need:
    http://be.enhansoft.com/post/2014/02/13/How-to-Use-RegKeyToMof.aspx
    Martin Bengtsson | www.imab.dk

  • What is the best way to move all of my data from an iPad 4 to an air?

    Santa brought an iPad Air and I need to transfer my data and apps from the old iPad I have had.  Help on the best way to do this since I played with the new machine yesterday and some of the things transfered but not all.
    Thanks!

    How to Transfer Everything from an Old iPad to New iPad
    http://osxdaily.com/2012/03/16/transfer-old-ipad-to-new-ipad/
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device
    http://support.apple.com/kb/HT2109
    Moving Content to a New iPad
    http://tinyurl.com/qzk2a26
    Transferring your prepaid cellular data account depends on your carrier. AT&T lets you move it yourself when you go to Cellular Data in Settings and log into your account with your previous AT&T user name and password. For iPads with Sprint service, you can set up an account on the new iPad and contact Sprint Customer Care (888-211-4727 and go through the menus) to deactivate the old plan and get credit for unused service. For Verizon, call the company’s customer service number for mobile broadband support (800-786-8419) and ask to have your account transferred.
     Cheers, Tom

Maybe you are looking for

  • My laptop no longer detects my built in webcam

    I have an HP G60-635DX notebook.   I have a built in webcam which I have used several times before, but now all of a sudden my laptop is not even detecting I have a built in webcam.  What to do?  I have a Mobile Intel 4 Series Express Webcam.  It bum

  • How to get the number of years, months with two sysdate()

    Hi All, Sorry for posted another question regarding the conversion. I have the hiring day and current day in date format like : '2005-10-01' and '2006-09-14' How to get the differences between current date is ('2006-09-01') and hiring date is ('2004-

  • Auto Creation of Purchase Requisition at Contract Level

    Hi All, I am having business requirement for creation of purchase requisition at contract level for third party Products. Brief Business requirement My client is in trading business of telecom product.  They are sourcing product from different-differ

  • Want to add field in standard table control - me21n , me22n , me23n

    Dear All , I have come across a situation where I want to add a field in a standard table control . But how to proceed for tht I am not getting . In the standad transation me22n in the ITEM  OVERVIEW table control I want to add Curreny field in the t

  • Where do you find a bar code that you scanned in your phone?

    I scanned a bbm code and can't locate it in my phone. Where would I go to find and research the information loaded on this code? Newbie to BlackBerry, "dumb founded"! Solved! Go to Solution.