How to read 16-bit signed integer in binary format with 2 byte sync. preceding??

A flowmeter provides data as 16-bit signed integer in binary format with 2 byte sync. preceding
I got i small problem by understanding the synchronasation.
I read the data provided by the flowmeter, and then write it to a binaryfile.dat. i need to convert the data to decimal format. is it better to convert the data before or after writing it to the binary file. Coz i need to read the data out again for calculations and save it again in a new file.
I understand that the synchronization  help one to see where to begin reading the usable data. is it right?
Need any suggestions
Thank you !
Zamzam
HFZ
Attachments:
DataOut.JPG ‏37 KB

HI Rolf.k.
Thank you for the small program it was helpfull.
You got right about that proberly there  will be conflict with some spurios data, I can already detect that when writing the data to a spreadsheet file.
I writes the data in such a way, that in each line there will be a date, a timestamp, a tab and a timestamp at the end. That means two columns.
When i set given samplerate up, that controls the rate of the data outflow from the device, (1,56 Hz - 200 Hz),   the data file that i write to , looks unorderet.
 i get more than one timestamp and severel datavalues in every line and so on down the spreadsheet file.
Now the question is: Could it be that the function that writes the data to the file,  can't handle the speed of the dataflow in such a way that the time stamp cant follow with the data flowspeed. so i'm trying to set the timestamp to be  with fractions of the seconds by adding the unit (<digit>) in the timestamp icon but its not working. Meaby when i take the fractions off a second within the timestamp i can get every timestamp with its right data value. Am i in deeb water or what do You mean!??
AAttached Pics part of program and a logfile over data written to file
regards
Zamzam
HFZ
Attachments:
DataFlowWR.JPG ‏159 KB
Datalogfile.JPG ‏386 KB

Similar Messages

  • How to scale 32-bit signed integer data to floating-p​oint voltage when acquring data in DAQmx by PXI4472?

    I acquired data in DAQmx by PXI4472. For the high speed data logger, I used "DAQmx Read" to read unscaled 32-bit signed integer data.
    Now, my question is how to scale 32-bit signed integer data to floating-point voltage?
    I think that it's (20/(2**24))*I32 because the voltage range of PXI4472 is -10 to +10 and its resolution is 24 bits. But I cann't get correct voltage by that formula.

    While you could hard code the scaling factor, it will be more flexible if you retrieve the scaling coefficients from the driver. To do this, you need to use the Analog Input>>General Properties>>Advanced>>Device Scaling Coefficients>>Device Scaling Coefficients properties under the DAQmx Channel Property Node. Look at the documentation for this property to see how it can be used to create a polynomial equation for scaling to volts.
    Since you are creating a data logging solution, you may want to consider using a compressed data stream from the driver instead of the I32 data type. This will allow you to read the data back as a stream of u8's instead. Since the PXI-4472 is 24 bits, you will only have to write 3 bytes to disk for each sample instead of 4. You can check out the following examples for how to create an application using this compressed data stream. It also shows how to use the scaling coefficients to transform the unscaled data back to voltage values.

  • How to parse 16 bit signed integer

    Currently, I am attempting to collect meaningful data from a flow meter
    connected through serial communication (RS-232 port).  The
    received data is a 16 bit signed integer in two's complement
    representation i.e. the 16 bit signed integer is in binary format with
    2 bytes synchronization  preceding. 
    For each value from the flow meter the byte sequence recevied is as
    follows:  0x7F (sync) , 0x7F (sync) , MSB , LSB.  When
    parsing, I would like to ignore the buffers and store/convert the
    correct values from the flow meter into decimals, but I do not know how
    to do that.  I attempted to use Instrument I/O Assistant and the
    programming similar to it, but I don't know how to identify the buffers
    as seperators. 
    Do any of you know how to do this?  Let me know if you need more information. Your help will be most appreciated. 

    Well, cast the entire string as an array of U32, use "split numbers" to get the last 16 bits each, cast to I16.
    (look ma, no loops! )
    Message Edited by altenbach on 10-12-2005 09:57 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cast.png ‏3 KB

  • How to read 32 bit depth .bmp image

    How to read 32 bit depth .bmp image using LabVIEW?
    @nk
    Solved!
    Go to Solution.

    A "standard" image, by which I mean an image type most typically encountered, stores image data in RGB format with 8 bits per colour, making them 24-bit images (24bbp - bits per pixel). A 32-bit image normally includes an additional 8 bits for the alpha channel, but in BMP files this format is complex (see wiki article), and it appears the LabVIEW Read BMP function does not support it.
    Do you have the IMAQ toolkit? I can't test the theory, but perhaps the IMAQ functions for reading image files are more advanced and can read your images?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Convert 8 bit unsigned integer to binary (base 2)

    i am trying to convert an 8 bit unsigned integer to binary (base 2) representation and use 8 LED's to show this representation.
    Like for integer 10, the binary is 00001010.....so the LED' s 1 and 3 should be on...

    The LED (boolean) indicators are simply placed into an array.
    To "borrow" an example of such a display, you could have a look at the code written for the parallel port example that can be found under the Help menu:
    Help > Find Examples :  Search "parallel"  HAve a look at the 1st or 2nd example.  They have LED's wired to a U8 array  (I think..  It's been a while since I looked at the example...   )

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How can i to convert a file to .m4a format with constant bitrate and constant overall bitrate?

    how can i to convert a file to .m4a format with constant bitrate and constant overall bitrate?

    "Surely you have the same check boxes as me? Surely you can make the same selections, AAC Encode, Custom bit rate, 256k or 320k or whatever you want... Sample rate 44.1KHz, Auto Channels and VBR not selected?"
    Yes.
    " Have you tested this? "
    Yes. I tested resulted files with "MediaInfo".
    "If so what are the results?"
    VBR.

  • How to read 16 bits at a time from a file.

    Hi everyone:
    I have a homework problem that requires me to read from a file 16 bits at a time, which is a signed value. I have tried using the code below:
    try     {
         FileInputStream fis = new FileInputStream(fileName);
         DataInputStream dis = new DataInputStream(fis);
         System.out.println("Reading "+fileName+"...");
         int x,y;
         bytes = new int [];
         for(y=0;y<height;y++)      {
              bytes[y] = dis.readByte();
              dis.close();
              fis.close();
              System.out.println("Read "+fileName+" Successfully.");
         } // try
         catch(Exception e)      {
              System.err.println(e.getMessage());
              System.exit(1);
    But this code only reads a byte at a time, I need to read 16 bits at a time. Does anyone have any ideas?
    Any help is greatly appreciated.
    Celia

    DataInputStream has another method that does what you want.

  • How to read from a xml file(in String format) using a java program

    hi friends
    i have a string , which is xml format. i want read the values and display it.can any one suggest how to read a xml file of string format using a javaprogram
    thanks

            final DocumentBuilder db =  DocumentBuilderFactory.newInstance().newDocumentBuilder();      
            final InputStream documentStream = new ByteArrayInputStream(documentXMLSourceString.getBytes("utf-8"));
            final Document document = db.parse(documentStream);

  • How to read columns of a Microsoft Excel .csv file with LabVIEW?

    This should be simple.  Any ideas on how to read an Excel file with csv extension using LabVIEW?
    Thanks!

    Use the Read From SpeadSheet File.VI which you can find on the FILE I/O pallette.
    "Read From Spreadsheet File
    Reads a specified number of lines
    or rows from a numeric text file beginning at a specified character offset and
    converts the data to a 2D, single-precision array of numbers. You optionally can transpose the
    array. The VI opens the file before reading from it and closes it afterwards.
    You can use this VI to read a spreadsheet file saved in text format. This VI
    calls the Spreadsheet String
    to Array function to convert the data."
    The CSV file is essentially a text file which uses commas as delimiters in the files structure.

  • How to read the content from a External Content Type with out creating External List in Sharepoint 2013?

    Hi,
    I have a requirement to read the External Content Type and storing the Data in a Session Variable. The Reading of the content from External Content Type with out creating a External List.
    Please help I am trying to find the solution, but unable to do that.
    Thanks,
    Pradeep

    Hi,
    Firstly an external content type designed to work with SharePoint list and there is no way to read apart from this.
    If you are looking the solution out of the " Business Connectivity" then find that data source has been exposed through WCF and  Web Service ?
    So you can use REST API and CSOM to consume those data in SharePoint.
    You can also leverage the ADO.NET option if the datasources based on MS technologies.
    Murugesa Pandian| MCPD | MCTS |SharePoint 2010

  • How do you get voice memos from iphone onto itunes with MANUAL sync?

    Ok, the iphone voice record function... I can't get the voice memos onto itunes or my computer. I don't use the autosync function, I like to manage my music and such manually.
    I cannot find a way to manually access the voice memos on my iphone through itunes. Many of them are too large to email so I'm stuck.
    The only option seems to be auto-sync, and if I do turn on the sync function at this point, itunes will completely erase my iphone and the voice memos I've recorded on it. Kind of defeats the purpose.
    Any tips?
    I've looked at a lot of posts and haven't found anything to help here. Just a bunch of posts complaining about how bad the voice recorder feature is integrated into the new iphone 3.0 software.
    i'm using a 32gb 3gs.

    Sorry for bumping an old topic, but I'm not quite sure if there is a solution to this.
    I have the same desire as OP, but yet I do not see my voice memos automatically syncing when I have manual sync selected. I also do not see a playlist folder or anything that indicates voice memos have transferred. Am I missing something? Is there no way to get voice memos onto the computer without having to autosync it?
    If someone can provide more details on how to do this, that'd be great. But it seems at this point that I cannot get voice memos onto my computer through iTunes with manual sync on.

  • How to most efficiently export photos on their original format with all metadata and adjustments?

    How do I most efficiently export photos on their original format with all metadata and adjustments applied? I am looking for a solution for exporting corrected photos between computers with Lightroom 5 installed. Preferably with no exporting or merging of catalogs.
    Thanks in advance for you support,
    JP Jacobsen

    And yet exporting a catalog is the perfect solution for communicating with another LR catalog...
    But if you really want to export photos , File>Export should work. I guess I don't really understand what your concerns are.

  • Format into string 16 bit signed integer

    Is there any format specifier string for "Format into string", whereas the result is an I16 string?
    My problem is when I use "%d" and the input string is 65535, the result string should be "-1".
    Solved!
    Go to Solution.

    Are you trying to get an integer out of an ASCII string (Scan from String) or turn an integer into a string (Format into String).  You title and question seem to contradict each other.
    Assuming you are trying to scan from string, it looks like you need to scan into a U16 and then use a conversion bullet to turn it into an I16.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Scan I16.png ‏11 KB

  • How to read the content of a blob col along with other cols as pipe delimit

    Hi,
    I would like to read the blob content along with the other columns . Assume table TAB1 has columns Response_log, Empcode and Ename. Here Response_log col is a blob data type, and the content of the blob is an xml file.Now i would like to read the content of the xml file of response_log column along with Empcode and Ename as pipe delimited . or else the best option would be to write to a text file with name extract.txt with the data being pipe delimited .
    create  table tab1(
    response_log blob,
    empcode  number,
    ename  varchar2(50 byte)
    )Sample code goes something like the one below .
    select xmltype( response_log, nls_charset_id( 'char_cs' ) ).getclobval() || '|' || empcode || '|' || ename
    from tab1 Can I have any other alternate way for this.
    Please advice

    Just Now one example is given in HOW TO WRITE ,SAVE A FILE IN BLOB COLUMN

Maybe you are looking for