Specification of starting byte of the string of bytes

Hello dear community,

I'm looking for a way to start reading a continuous string series increments specified in specific positions of the string. I'll explain:

The idea is using an Arduino board to read analog values of the 16 photodiodes and send their data as ascii to my computer. Values of the analog pins are of the order of 10-bit, so there are 2 bytes information needed by the photodiode. Now, I need to assign the right 2 bytes in this continuous string corresponding photodiode. Then before the Council begins to read all diodes, I programmed to send 2 bytes (lets say "xx") as an indicator of starting leading to 2 bytes ("xx", indicator of start) + 16 * 2 bytes (= data of photodiodes) = 34 byte increments.

My plan now is to implement a routine, that bed of 34 bytes, concludes the 'xx' sequence and the position of the extracts (allows to call the post number 'y') of the first 'x '. The program reads now y bytes. And now, the program reads again 34 bytes in a continuous cycle, each cycle starting with "xx".

How do I know that?

I added the plan I work at: the structure in question is placed in the first frame of time. [Note that so far, this program only reads that the 2 bytes (= first photodiode).] The first VISA Read structure must find the position of 'xx' and send it to the second structure VISA Read, who transmits to us at the beginning of the next full increase.

Best regards

Froebel, Friedrich G.

Hi, Friedrich.

I made a few changes as well as a suggestion on how to analyze your data...

Tags: NI Software

Similar Questions

  • extract the string reg expression?

    How to extract P '89' 84 of this field?

    CSOM 50, HON 93, P '89' 84 JASPER YOUR L

    The string P I could start anywhere in the string, but is always followed by an apostrophe. It could be any length with a series of apostrophes and the years ending with a white or the end of the field.

    I think that regular expressions should solve this problem, but I can't understand it. Any help is appreciated.

    Hello

    Here's one way:

    REGEXP_SUBSTR ( txt
               , 'P'          || -- The letter P
              '('          || -- Begin \1
                  ''''     ||     -- apostophe
                  '[0-9]+'     ||     -- 1 or more digits (see below for alternative)
              ')+'          || -- End \1, which may occur 1 or more times
              '( |$)'             -- Either space or end-of-string
               )
    

    If the years must be exactly two digits, then change the line 5 to:

    ...              '[0-9]{2}'     ||     -- exactly 2 digits
    
  • Doc XML to a string fails when the string length is greater than 512 bytes.

    I have been using the following code to write an XML string.  If the resulting string is lower to ~ 512 bytes, the string will be created, if > ~ 512 bytes, the routine does not create the string.  Assuming that the doc contains an XML document:

    Doc CVIXMLDocument = 0;
    HDoc MSXMLObj_IXMLDOMDocument = 0;

    ...

    cvistatus = CVIXMLSaveDocument (doc, 0, "Test1.xml");
    status = CVIXMLGetDocumentActiveXHandle(doc, &hDoc);)

    hRlt = MSXML_IXMLDOMDocumentGetxml (hDoc, & errInfo & strXml);

    The SaveDocument routine still works, the XML file contains the XML, regardless of their size.

    The Getxml routine creates only the XML string in strXml when the length of the string is lower to ~ 512 bytes.

    Does anyone have an idea of the problem?

    Because the string is very long, the ICB debugger cannot display. That's why I was wondering if you were trying to print using put or printf. Because the return value is 0 and the ERRORINFO is also stating the success, I would recheck the chain by printing it to the console or a file.

  • 2 PL/SQL insert new string in the string specified to a specific Position

    Hello

    PL/SQL insert new string in the string specified to a specific Position

    Continuing the previous thread has answered, I would like to know how to cut the data after the underscore ("_").

    Example:

    Old chain: D100_RT

    New string:APPROX100 d.

    Here after, what is there after that execution should be deleted.

    Thank you

    Suppose that the string = D100_RT

    select substr('D100_RT', 1, instr('D100_RT','_')-1 )
    from dual
    
  • Set the string for LabView dll parameter

    Hello

    I created a simple vi LV 2010 (departure vi), which reads the identification of an oscilloscope. Then I take this vi and incorporate it into a dll of LabView. I have test the dll calling LabView (RunFrom dll). Basically, it seems to work, but len and ReadBuffer back empty. It must be in the way I'm configuration configuring the setting for Readbuffer (settings) in the configuration of the dll. I tried several different configurations, but nothing seems to work. Any help is appreciated!

    What is the parameter len?  Normally, you should only set the length of the string, but it seems that you did not do this.  Also, you're passing len by value, and not by reference, so the function is expecting her to be a starter and you will never get return a different value to any value that you provide.

    Do not use a local variable of the ReadBuffer for entry "readbuffer".  You must pass a string initialized long enough to contain the expected quantity of data.  The best way to proceed is to use the array to initialize to create a table of U8, then use the array of bytes to a string.  Set the parameter 'minimum size' to 'len' then run through the length of the string initialized (this is not mandatory but is recommended).  If you need the length obtained output, add another indicator and another parameter to this value.  There might be a way to do it with one by len parameter passing by reference, you need to experiment (it is certainly feasible in C but I don't know if allows him to LabVIEW).

  • Use INSTR to extract a piece of the string?

    The guys from morning and Happy Friday.

    I have a situation where I have to take advantage of the string by using a select statement.

    Here's the chain I have to get the content between the 2nd and 3rd backslash. So basically I have to extract marypoppins. Any ideas?
    C:\USERS\marypoppins\Docs\Specification
    Here's where I started... and I've fallen on trying to find the 3rd backslash. I can easily start the INSTR 4 because I know that he will always be "C:\". »
    select select substr(C:\USERS\marypoppins\Docs\Specification',
                                INSTRB('C:\USERS\marypoppins\Docs\Specification', '\', 4), .....) from dual;
    WITH abc AS
         (SELECT 'C:\USERS\marypoppins\Docs\Specification' a
            FROM DUAL)
    SELECT SUBSTR (a,
                   INSTR (a, '\', 1, 2) + 1,
                   INSTR (a, '\', 1, 3) - INSTR (a, '\', 1, 2) - 1
                  )
      FROM abc;
    
  • Insert a space in the string

    Hello

    I'm trying to put spaces in the string after each 4 characters (2 bytes).

    Any help will be greatly appreciated.

    Thank you

    hiNi.

    Several ways to do so.  My favorite is the regular expressions...

  • Using the string Variable name to ChnFind

    Overview - I find crossing points of zero on a set of data so that I can calculate the phase shift of channel to another in my data.

    Small image - I start by finding the zero 1 cross in the data, once I found I want to use the index to find the next and so on

    Problem

    The posted script comes from looking for the 1st pass by zero before moving on to the next channel. The problem is that I can't find out do my group and channel changes with loops.

    Option Explicit  ' force explicit declaration of all variables in a script.
    Dim intCount, intChan ' loop variables
    Dim z

    IntCount = 2 GroupCount-1 ' groups
    Call GROUPDEFAULTSET (intCount) ' change the current group
    IntChan = 1 to ChnNoMax ' Browse channels
    Z = ChnFind ("Ch(""[intCount]/[intchan]"")<0") 'this="" does="" not="" work,="" but="" i'm="" not="" sure="" how="" to="" fix="">
    MsgBox (z)
    next

    I don't know I'm missing something obvious.

    MK

    Hi Michael,

    You need not global variables to simplify this, but I would certainly use object variables to simplify.  When indexing of groups or channels, it is easier to use the variable of index with the Data.Root.ChannelGroups collect or Group.Channels collection directly.  I also prefer to store the group object and the channel object in a variable.  For example, you can then use Channel.DataType to add exactly the same string data to the new group coming from the old group.  You can also easily get the name, unit and all sorts of other properties directly from the object variable.  I prefer to use a separate group object variable to reduce congestion in the colde, although it adds 2 lines to your example of code snippet.

    Set FromGroup = Data.Root.ChannelGroups (intCount)
    Set FromChannel = FromGroup.Channels (intChan)
    Define participatory = Data.Root.ChannelGroups ("Index" & FromGroup.Name)
    The rise in the value = ToGroup.Channels.Add (FromChannel.Name & "Rising", DataTypeChnFloat64)
    Fall in the value = ToGroup.Channels.Add (FromChannel.Name & "Falling", DataTypeChnFloat64)

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Structure from case string "&lt;------"-LabVIEW converts the string

    Hello

    I want to parse the string lines read from a data file.  Some chains start with the characters ".<\".  when="" i="" enter="" this="" kind="" of="" string="" as="" a="" case="" in="" a="" case="" structure="" the="" string="" is="" being="">

    For example, I'm going home. "<\C" (upper-case="" c)="" as="" my="" case="" string,="" it="" changes="" to=""><\f".  if="" i="" enter=""><\c" (lower-case="" c)="" as="" the="" string="" it="" becomes="">

    I am currently using LabVIEW 2012.

    Any ideas what's happening?

    Thank you

    Ian

    Some ASCII characters are nonprinting control characters (less than 32 values). These are sometimes encoded using the backslash code and it seems that is what makes the structure of matter - when you type \C, the structure of the performer as "oh, you want the value 0x0C ASCII, which in the code for backslash is represented" as \f (means 'form feed). "When this is the case, you typically use one-to represent the------characters, so you really need set the structure to match on.<>

  • EXCEL ActiveX + error '-2146827284' (but not the string length limit)

    Hi all

    First of all thanks for your help!

    I have a strange error with excel activeX: "-2146827284!"

    Why strange? Because my export feature works perfectly on a computer but not on another... (both are windows 7 + Excel 2007)

    How my application works:

    I have to read an excel spreadsheet which preserves made with different types of instruments of measures.

    For each type of instrument, I have to create a specific worksheet with its measures.

    For example:

    1 spreadsheet excel with the many measures of 4 different types of instruments

    SHOULD GIVE

    4 excel spreadsheets containing the measures of each instrument (1 worksheet for a type of instrument).

    Hope I am clear...

    Why I do with LV? Because it's fun!

    Now that some snapshoot.

    1 - where the bug appears :

    2 - the message I get (translated from french to English):

    Additional information:

    -The size of the string I have write in excel cells is 6 characters max. More I put a condition to return an error if the string length is > 900 characters.

    Thanks a lot for your help!

    SO simple...

    It was just the name of the folder...

    I coded the name of the folder as a constant aim dev. And I do not mind that the name of the folder is not the same on both computers!

    "a missing letter = a week closed.

    Arrrgh

    all sorry to bother you

  • How to convert the string with numbers in the table of Boolean 2D

    Hello

    I have input a string with comma separated numbers 1,192 (starting at 1).

    This string must be converted to a table 2D-boolean. Each number that appears should be true, not true rest.

    The 2D table consists of 4 times of 0.47 Boolean values.

    1.48--> [0.47] numbers [0]
    49.96--> [0.47] numbers [1]
    Numbers 97.144--> [0.47] [2]
    145.192--> [0.47] numbers [3]

    If a '1, 49, 97 145' input string put all [0] [0.3] true.

    How can it be easy/fast resolved?

    Thanks for help

    Break the string of numbers in a table of numbers.  (Spreasheet String to Array).

    In a loop For, index with each issue of this table.  Use in the range and Coerce to see if it is in the range of numbers.  (You can put this in a loop For as auto good indexing through the ranges).  If it's in the range, then use subset replace table to activate the corresponding item in a real.  If this is not the case, do nothing.  Maintain the table of Boolean in a shift register.

    Repeat this step for each number in your table.

    (What is a class assignment?)

  • Incorporate the binary string in the string spreadsheet file

    Hello LabVIEW wizards...

    So I use scripture to VI file spreadsheet to create a beautiful layout, tabs-delimited report of one of my programs for the acquisition of data file. In one of the cells in the resulting worksheet file that I want to put a binary string of all my control values so when you open the data file all the control parameters used for its manufacture are restored, but the string is hidden when the report is displayed in Excel.

    The problem is that the binary string flattened uses tabs and returns as part of its syntax the Spreadsheet File this VI to Write it's going in all directions. Worse yet, I can't unflatten chain when I open the file text because of "corrupt data or unexpected".

    If I concatenate the string flattened with quotes around it she is superb and is placed in a single cell in Excel, but when I open the file in LabVIEW that she is still several elements in the array. I've isolated the binary string using the file VI text reading and got a subset of the quoted string, but it still unflatten correctly.

    Essentially, I need to know how to get LabVIEW to pull a string literal full of special characters into a spreadsheet file and it unflatten. Any gurus what help you can provide is greatly appreciated.

    Thank you

    Jordan

    Jordan

    I suggest that you change the formatting of your chain shipped by replacing the tabs and returns with other characters that are not considered as commands by the spreadsheet functions. Without knowing how you represent your control binary values, I can't offer specific characters.

    If two non-printable characters exist which do not appear in the control data, it's easy: just find and replace tabs and returns with those characters.  If there is no character, then something more complex needs to be done for example to escape special characters.  Or create two subVIs - one to remove the tabs and returns before writing the string in the file and the other to restore after reading.

    Lynn

  • How to convert the string with numbers in U8 with ascii

    Hello

    I have a string with only numbers 0. 9 paper.

    Now, I want to convert to table-U8.

    He works here, but now the problem: How can I change each character to its ascii value?

    Example:

    entry: 123 (string)

    output: x 31, x 32, x 33 (U8-array)

    Thanks for the help

    It's very easy

    String to Byte Array Function
    Have the Palette: string/array/path Conversion functions

    Converts a string to an array of unsigned bytes. Each byte in the array has the ASCII value of the character corresponding to the string.

  • How do to convert the string (with the Hex data) in number?

    Hello

    I use TestStand 3.5 to automate a few test cases associated with boot loader.

    The requirement is that I need to read the value in some places for specific address. The values of these addresses are stored in a hexadecimal format.

    We have a step customized in TestStand through which we can read these values by address, but she returns as the type "String".

    For example, the value to 0 x 0000008 is 000001 B 2, and he returned in Locals.Value_Read as "000001 B 2" in the string.

    Is it possible, I can convert the string "000001 B 2" to a number?

    I tried to use the function-> val (locals. Value_Read), but it is return 0 as TestStand figures that the input string is not representing the valid number.

    Please help me with this.

    Thank you and best regards,

    Niraj.

    Try: Val ("0 x" + Locals.Value_Read)

  • Build specification does include all of the files for my VI.

    Hello!

    As part of a semester project, I have to build a VI to control a filtration unit. The VI works fine on my computer, but I control the next month and I need to send files to a person on the University. The problem is that even if I use the function 'Build Specification' (I use the 2011 LabView professional development system), the files are still missing when the program is started on the new computer. A warning in the project file indicates that the files are missing or removed to another location. A file named pid.lib is not found, and it seems that the path of each file is the same on my computer, but does not change the specification of build that adjust the new computer.

    I am a newbe LabView and I have searced this forum and help files to try to solve this problem by myself, but now my time is more limited. Can someone help me with this?

    Henrik jepsen

    Master Chemical Engineering

    Denmark

    Hi Henrik

    You can see what versions of LabVIEW and toolboxes installed in measurement and Automation Explorer (MAX). If you MAX Open and select 'my system'--> 'software in the menu of left, then you can see all installed software.

    If you click on the installation of LabVIEW. In this case, LabVIEW 2011, you can see all the installed tool boxes.

    When you run a LabVIEW project / application on another PC, LabVIEW will use a priority defined in the place where to load the files to. This is specified in Tools--> Options-->--> VI search path Path.

    For LabVIEW will be frist was trying to find the VI/VI library in your project folder and if the VI is not located there it will look like for her as a function of generation in vilib, userlib or LabVIEW instrlib files. These files contains VI and VI installed with LabVIEW libraries.

    In this case, as mentioned above you correctly do not have the same toolboxes installed on both machines. This is why the PID.lib is not found in the vilib folder as it should be, and so you get the error. You can check by looking at the installed modules, as mentioned above.

    Best regards

    Anders Rohde

    Technical sales engineer

    National Instruments Denmark

Maybe you are looking for