Convert digital waveform to array

Hello,
I posted a problem before Christmas regarding data acquisition and accessing the hardware buffer on a 6562 card. I managed to figure out that problem but now I'm stuck when I try manipulating the data I obtain. (The original problem can be seen here: http://forums.ni.com/ni/board/message?board.id=70&​thread.id=7926)
Briefly, my application is clocking and synchronising an ADC board and then looking at the raw ADC data that comes back from the board. To provide synchronisation I am sending a sync pattern on one data line and using a second line to send a "start of frame" indicator, a '1' bit when I know that the board is synchronised. This line otherwise only sends ‘0’s. This cable is wired back into the NI card and LabView. All data sent uses the NI-SHDIO Generation Express VI and I'm using the Acquisition Express VI in parallel with the Generation VI to capture the raw ADC data when it comes off the ADC board. Since I am acquiring both the ADC data and the frame indication data (which I am looping by connecting that output DIO to an input DIO), the digital waveform essentially contains 2 arrays and I can view these from a graph indicator within LabView.
No problems so far. In order to manipulate the data and look at individual frames I am writing the ADC data to file. To extract the digital data from the digital waveform I am using the following VIs:
-Get Waveform Components
-Get Digital Data Components
-Write to Binary File
To view and manipulate the data I read it into Matlab and this is where I can tell that something's not right. When I read the file into a variable in Matlab, the variable becomes a 1D double array of 40,008 elements. This seems very odd, considering the Acquisition VI only takes 20,000 samples. When I look at the 1D array more closely it looks like the two arrays have been cross added in some fashion. The 1D array certainly doesn't match either of the two arrays visible in the graph indicator inside LabView. I can understand if the file is reading one array after the other (20,000 + 20,000 almost equals 40,008 after all) but that doesn't appear to be the case.
I would greatly appreciate some help on how I can extract the two data lines either using Matlab or LabView. Currently it looks like LabView is making a hash of things whenever I try to manipulate or extract the two arrays from the digital waveform. I have tried a multitude of different VIs and ideas but nothing appears to work.
The most straight forward way would be using the "Converting Digital Waveform to Binary VI" but it can't handle two arrays within the same waveform. (The result looks like the two arrays exclusively OR’d together). To combat this I tried running two Acquisition Express VIs in parallel (one for ADC data, the other for the frame info) but got an error message referring to invalid handles. I presumed this meant that I can't run two acquisition VIs simultaneously, judging from forum posts of users facing the same error message.
Sorry for the long post but I feel that I needed to fully explain the problem. I'm attaching my LabView code.
Thank you for reading,
Christian
PS. GenAcq2.vi is my code. Waveform_GenAcq2_Cfg.hws is sent by the first Generation VI; Waveform_GenAcq2_shorter_frame_indicators.hws by the second Generation VI.
Attachments:
CodeAndWaveforms.zip ‏126 KB
GenAcq_Screenshot.JPG ‏83 KB

The extra "8" is being caused by the fact that the "Write to Binary File" VI has a "prepend array or string size" input. Its default is true, and in your case you have it unwired, so you get the array size prepended. As for the rest of your issue, what are your Matlab commands to read a file? The following example VI, which generates a digital waveform and saves it to file,
can be correctly read into Matlab using the following commands:
fid = fopen('c:\temp\digData.bin','r');
F=fread(fid, [256,8], 'uchar');
Message Edited by smercurio_fc on 01-18-2008 05:26 PM
Attachments:
Example_VI_BD.png ‏11 KB

Similar Messages

  • Converting digital waveform into bit sequence

    Dear friends,
    I am stuck with the task of converting a digital waveform (16 bit values) into
    the following waveform:
    each sample of the original waveform should be represented by a sequence of
    bits (or H and L analog values) in the second waveform,
    the duration of the bit sequence should be half (in general arbitrary fraction)
    of the sample clock period of the original waveform,
    the bit sequence should be padded by zeros so that the total duration of the
    bit sequence and the pad equals to the sample clock period of the first
    waveform.
    I tried to represent these two waveforms in the picture attached.
    It would be really great if someone could give me hints/suggestions to this
    problem!
    Thanks in advance!
    Attachments:
    waveforms.JPG ‏21 KB

    Hi SamboNI,
    Thanks for your reply!
    I have couple of notes:
    I tried to implement your instructions but the LabView gives error message
    (please see the screenshot attached).
    I guess there should be "Boolean to (1,0)" VI between "Number to
    Boolean Array" and "Build Array" VIs (?)
    The problem I have is a bit more complex:
    I have a digital waveform (16 bit integers). I need to transform the waveform
    in the easiest and fastest way into the following form:
    Each sample of the original waveform (16 bit integer number, i.e. 5) should be
    represented by a sequence of 0s and 1s corresponding to the bit sequence of that number (0000000000000101 for 5) padded
    by a sequence of zeros (i.e. 00000) in the final waveform. I will use the
    final waveform to drive single line of the 6534 board instead of 16 lines of
    this bopard in the case of the original waveform.
    More generally:
    I need to realize communication protocol with the AD5541
    Digital-to Analog converter from Analog Devices (
    http://www.analog.com/en/prod/0%2C2877%2CAD5541%2C00.html ) using 6534 NI
    board. Therefore I need also build SCLK and CS waveforms and synchronize
    them with the DATA waveform I was talking above. Is there a way to do this?
    By the way - do LabView have standard means to communicate
    with devices like AD5541? Does it require a special software module and/or
    hardware board?
    Thanks in advance!
    Attachments:
    NumToBoolErr.JPG ‏16 KB

  • Counting number of 1's present in digital waveform obtained by converting the pulse signals.

    Hello,
    I am using Analogtodigital.Vi for converting the pulse sequences into digital.signals.I am able to get the digital waveform representaion of the pulses.
    But how to count the number of 1's present in the converted digital waveform.I want to count the number of 1's present in the converted digital waveform.
    Thanks in Advance.
    Solved!
    Go to Solution.

    Did you try opening the block diagram of Analog to Digital.vi? 
    It creates an uncompressed 2D array of 1s and 0s which represents the 16-bit binary A/D conversion of each element in the Y array of the input waveform. You can use the DWDT Digital to Boolean Array.vi to convert to a 2D array of booleans. Then convert the booleans to 1,0 and sum the array of integers. The sum should be the count of 1s in the digital waveform.
    Lynn
    Note: The attached VI is saved back to version 8.6. When I saved it for Previous Version a warning was generated about possible differences in versions. Let me know if it does not work, and what version of LV you are using.
    Attachments:
    Count bits.vi ‏25 KB

  • Most efficient coding method to get from WFM Digital to Timestamp Array and Channel Number Array - Earn Kudos Here !

    I'm Fetching data from a digitizer card using the niHSDIO Fetch Waveform VI.  After Fetching the data I want to keep the Timestamp and Digital Pattern which I'll stream to TMDS file.
    What is the most efficient method of striping out the Arrays I'm interested in keeping?
    The attached VI shows the input format and desired output.  The Record Length is always 1.  I'll be streaming 100,000+ records to file using a producer-consumer architecture with the consumer performing a TDMS write.
    I'm assuming only the WDT Fetch gives you the time from t0.
    Attachments:
    Digital Waveform to Array Coding.vi ‏11 KB

    Hi bmann2000,
    I'm not sure about efficiency but this method definitely works. I've just used a 'Get Digital Waveform Component' function and the 'Digital to Boolean Array' function.
    Hope this helps.
    Chris
    National Instruments - Tech Support
    Attachments:
    Digital Waveform to Array Coding 2.vi ‏15 KB

  • Coverting a boolean array to a digital waveform

    Hello,
       I have a 20 bit Boolean array that I need to convert into a digital waveform. Is there a easy way to do that?
    Regards,
    Kaspar
    Regards,
    Kaspar

    Hi xdaf,
    The reason why this VI takes in a 2D array is because this is often used to create digital waveforms with multiple channels and therefore, every row would correspond to data for each channel. To go around this problem, you may simply increase the dimension of your 1D array to a 2D array by feeding it in a Build Array function. Note that although you are increasing it's dimension, you are not adding any new data.
    I hope this answers your question.
    Message Edited by S_Hong on 12-03-2008 02:03 PM
    S_Hong
    National Instruments
    Applications Engineer
    Attachments:
    Digital Waveform.png ‏2 KB

  • 1D Array of Digital Waveform

    I have a 1D array of digital waveform and I need to work with the data from it. I can't seem to get the "numbers" from it to work with any array function or any other type of function for that matter.
    I need to be able to convert these so I can find a particular value in the array.
    Thanks.

    Have you tried separating the array into individual waveforms using Index Array VI?  You should be able to use the Get Waveform Components (Digital Waveform) VI on each wavefrom once you separate the array into its component waveforms.  Then you can convert the digital waveform into a Boolean Array using the Digital to Boolean Array VI.  You can then use boolean logic to determine when both waveforms output 1s.

  • How to convert digital array data into analog signal

    i want help to convert digital data array into analog signal

    shubham62 wrote:
    We are implimenting real time audio trans-receiver. We have converted input audio data(analog form) into digital data. At the receiver side we received digital data which is in the form of digital data array.But we are unable to recover back our original input data. So please help us to sort out the problem.
    Still no useful information.  How was the data converted to digital in the first place?  What conversion parameters did you use?  As was said, you just need to do the math backwards to get it back into the analog.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to convert a waveform signal into array of complex numbers

    How to convert a waveform signal into array of complex numbers.

    Hi Chaks,
    try this:
    (Get Waveform components, convert to complex DBL)
    Message Edited by GerdW on 01-28-2008 09:23 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    ToCDB.png ‏1 KB

  • How do I output three digital waveforms at once?

    I posted this in Digital I/O, but now I think it's actually more appropriate here because it's not a hardware question. I need to output three digital waveforms at a relatively low frequency, 71.9 Hz. I have a PCI DAQ card, the 6024E and am using the NI-DAQmx functions to try to do this. My program basically generates the square wave that I want, and converts it into a digital wave. I do this 3 times for the three separate waves, and then I combine them into an array and send them to my DAQ functions, which are in a while loop so I can get continuous output. My problem is that the waveform that the DAQ is actually outputting is not what I want. It's outputting a wave that has the same duty cycle (approximately) but the frequency is over 2 kilohertz. It's not like this all the time; after it outputs about 7 cycles of this wave, it goes to logic low for a long time, and then repeats itself. When I probe the digital waveform right before it goes into the DAQ functions, it's running correctly at 71.9 Hertz. Am I doing anything wrong with the DAQ functions or the sampling information? Thanks in advance.
    -- Josh Matloff

    Hello Josh,
    I'm pretty sure that the reason that your digital waveforms are not being produced at the correct frequency is because your digital output is not associated with any sort of timing. Unfortunately, with an E series board you can only do software timed digital operations. This means that the frequency at which the values on your digital lines will be updated depends on how fast/often your computer executes the DAQmx Write that is inside of your while loop. If you have an M series board, you can actually correlate the DIO operations with another subsytems clock (AI/AO sample clock, etc.) which means that you can acheive hardware-timed DIO. In the event that you do not have access to an M series board, I think that AnalogKid2DigitalMan was spot on that you would want to use counters to generate pulse trains (that is if your digital waveforms have a constant duty cycle and period). Depending on what the DAQ board is outputting to, you might also want to consider using the Analog Output channels to generate your digital waveform. As long as you continue to use the digital lines on the 6024E, there is not really a way to guarantee the timing of when the digital lines will be updated. You might be able to get close, but you will probably see some "hiccups", especially if your computer needs to service interrupts or give processing time to another application. And lastly, heed geckoee's advice and don't forget to properly close out your tasks! Putting in some error handling may also help in the debugging process.
    Take care,
    E.Lee
    Eric
    DE For Life!

  • Memory leak in Digital Waveform

    I have a program with a pretty serious memory leak that uses up all my system RAM and crashes my computer within a few hours of running the program.
    The program takes an array of U16s where each bit represents a digital signal. The VI converts each U16 to a digital array and groups the resulting 16 digital signals into different busses for display on a Digital Waveform Graph. The profiler doesn't show any excessive memory usage in the VI. I put the whole VI into a Diagram Disable structure and moved a few pieces out at a time, and eventually the only thing inside the disable structure was the Digital Waveform Graph indicator. When this indicator is enabled, the memory usage of my system rises slowly and steadily until it uses all available RAM and crashes the system.
    If I replace the Digital Waveform Graph indicator with a cluster, the memory leak still occurs (but much more slowly). I thought using the cluster fixed the leak until I reran the VI overnight while using the cluster instead of the Graph.
    If I stop the VI before all the RAM is used, the RAM will not release until I close LabVIEW entirely. Once LabVIEW closes, the memory is released slowly and exponentially unless I use the "End Process" option in Task Manager.
    This is a continuation of a previous post I made where I thought the memory leak was due to problems transferring data from an FPGA for display.
    I ran the MemLeak vi (attached) on two separate systems, both running LV 2013 SP1, and got the same results. The memory leak is noticeably fast when using the enable structure connected to the Digital Waveform Graph but still present when using the cluster of Digital Waveforms.
    Attachments:
    MemLeak.vi ‏33 KB
    LV shutdown.PNG ‏101 KB

    Thanks for the replies.
    In response to John's points:
    1. The attached VI is a simplification of an FPGA VI that read a fixed number of samples from a DMA FIFO using an FPGA Interface Invoke Method approach. I'm using a card (PXI-7842R) that doesn't allow use of the Acquire Read Region method. In order to allow people without an FPGA card to hopefully see the issue, I replaced it with the for loop. Assuming that this for loop does leak (which I don't believe it does; as altenbach said, it's a fixed size allocation that LV should be able to reuse), why would I see a difference in the leak magnitude depending on which indicator I connect to the array?
    2. I've previously reviewed the document you referenced, and I don't see any errors from it present in my code; do you? I have no global/local variables, strings/arrays displayed on front panel, property nodes, coercion dots, altered memory sizes, resizing/reallocations, etc. I don't see any weird buffer allocations. I used to have the conversion from U16 array to digital waveforms in a subVI but placed it on the same diagram to allow incremental use of the Diagram Disable structure.
    3. The forum post you referenced had many of the items discussed above, plus it was solved using an RT FIFO. I'm not passing data from a producer to a consumer; I'm just displaying acquisition results. I guess you could say I'm processing the data, but I'm really only converting it to a format that the indicator will take; I'm not operating on the data.
    It's good that the leak doesn't show up in 2014, but my SSP runs out in a couple of days; I never got an upgrade to 2014. This is the last item remaining on the development path, and we've already spent ~$4k to upgrade the controllers enough to display the acquisition without dragging down the CPU. I will be in hot water if I spent all that money and then end up having to scrap the display...

  • Generate digital waveform form a read from spreadsheet.vi

    Hi, I'm very new to LabView and am having some problems in completing what I believed would be a very simple task.
    I am using the Read from Spreadsheet.vi to read in an Ascii tab delimited file that I created in Matlab (the file is simple a vector of 1's and 0's that represent a binary stream) All that I want to do is take the output from this and generate a digital waveform corresponding to the 1's and 0's in the array but I cannot find a way of doing this.....
    Help much appreciated,
    Thanks.

    You should be able to just run your data straight  in to the digital write function as long as you select the correct port width of your hardware.
    If you want to do it with a digital waveform it's a bit trickier, the digital waveform data type is a surprisingly complex animal.
    There might be a better way to do it, but this is what I've had to do in the past...
    The "build digital data" function needs a 2D array in, so convert your 1D array into a 2D.
    Then the digital data can be input into a Build Digital Waveform.
    Then the digital waveform can be output with the write digital waveform.
    Message Edited by Troy K on 03-23-2008 11:37 AM
    Troy
    CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
    I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
    Beware of the man who won't be bothered with details. - William Feather
    The greatest of faults is to be conscious of none. - Thomas Carlyle
    Attachments:
    array_to_digital1.png ‏4 KB
    array_to_digital.png ‏9 KB

  • Digital waveform to boolean value

    Hi, I have a digital waveform and I want to be able to light up an LED on the front panel every time the waveform is high...
    What is the best way to do this?
    I know there is a vi that converts a digital waveform to a 2D boolean array, but I just want a single boolean value.
    Thanks!
    Sunny

    Hi
    In reference to my previous post, you can just leave the inner for-loop, but you have to extract the 4 channels.
    Just have a look at the picture.
    Hope this helps.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    DigitalWaveform.png ‏6 KB

  • Export digital waveform+labview

    Hi to everyone...I'm a newbie with labview, and I want some help for the beggining...Well I'm working on a project and for start I must use an arbitrary signal and an oscilloscope so as I can see the the graph of it(for simplicity I used a sinus in the beggining...)and then I must use an A/D converter and the digitalized output must be saved in a .txt file so that I can read it...So I wired the sinus with the A/D converter but then I cannot make the output of it compatible so that I can save it...I used the component "export waveforms to spreadsheet file.vi" but it says error diffent type of data you cannot wire a "Digital waveform" with the input of the file "1-D array of waveform(DBL)"????I used and some other components for saving in a file but it didn't go better...What did I do wrong???Please if anyone can help me...I would appreciated!!!
    Solved!
    Go to Solution.

    Hi again...I want some help...Last time I sent you "my_main.vi" file and told you that had a problem about making time to be correct in the .txt file...I haven't solved it yet, although I tried a lot to find how I can change this the txt. Anyway for now what concerns me most is that although the gragh(with the formula i use) i see in the front panel is correct when i take the data from the .txt file and paste it to a .xls file and making a graph it seems that there are pulses of the same amplitude before the visible signal i see in my front panel...I couldn't understand why this was happening but after a while i put the same formula in a grahp calculator that i have and saw that the previous pulses are not of the same amplitude, they just appear to be so because the amplitude that is set to the component isn't enough to show their whole amplitude...so they are been cut off and seem to be the same...So i tried to change the values at the x-axis but I didn't make it.The program holds some certain range(0-4) that I had initially set to it...At the bottom line I'm facing a problem to appear the rest of the graph in the component's output, and also to fix the phenomenically wrong pulses to my .txt file...Please I would appreciated if anyone can help me...Im sending you all files to have a picture of wht's going on...
    Thank you for your time...
    Michalis V.
    Postgraduate Student
    Department of Informatics and Telecommunications
    National & Kapodistrian University of Athens  
    Attachments:
    my_main.vi ‏20 KB
    results.txt ‏154 KB
    samples.xls ‏428 KB

  • Digital waveform to 1-d digital waveform?

    Hello I am new to LabVIEW and wondering how can I convert a digital waveform to a 1-D Digital Waveform? Also how can I post my code and errors?

    Just wire it to the Build Array function.
    You should see the Attachment option right below the message body.

  • Equivalent of Split Signals for digital waveform

    Hi , I read multi digital waveforms in a loop and I would like to split the channels. For analog waveform I can simply use split signals control. How about digital waveform, is there any equivalent for digital channels?

    You can use firstly "Digital to Boolean Array VI" to get a 2D boolean aray equivalent of Digital Waveform samples...!!
    But remember at this step, the sampling rate information (dt) will be lost (after you've converted the digital waveform to 2d array of boolean)...
    Now next, if I'm not wrong, here each column would represent different waveforms...!!
    At last, you can use "Boolean Array to Digital VI" to convert 2d array of boolean back to digital waveform...!! You will require dt (sampling rate info) here at this step...!!
    Additionaly to extract sampling rate info from the digital waveform, before you convert it to boolean array, you can use "Get Waveform Components (Digital Waveform) Function"
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

Maybe you are looking for

  • AdapterModule Development using NWDI

    Hi all, could you please be so kind and tell me, how i can devlop an adaptermodule for PI 7.1 using NWDI (for central build + transport) I know how to develop an adapter module using netweaver developer studio, but the problem with this approach is,

  • Re: Problem with NOKIA 5220 XpressMusic

    I bought a NOKIA 5220 XpressMusic a few days back . Evrything seemed fine , but suddenly I could not access my memory card. It says "Memory card has to be formatted" and then peration failed". Memory card doesnt show up on the computer also. What cou

  • I was updating my iphone to ios6 earlier and paused it when i went out, now can't restart it?

    I had my iphone ipdated onto ios6 earlier in the apple store, but obviously had to leave whilst it was still updating, and as i lost wifi i told my iphone to pause the update and resume it later on, now i'm trying to resume the update and i don't kno

  • Truecrypt-6.0a to 6.1 - error: "No entry for device-mapper found."

    /proc/misc: No entry for device-mapper found Is device-mapper driver missing from kernel? Failure to communicate with kernel device-mapper driver. Command failed that's the full error I get when trying to mount my encrypted drive - I'm sure there is

  • Regex pattern

    I am using (?!^)\\b which produces all tokens and delimiters from a string.split(); I would like it to also separate a ');' pair into ')' and ';' Any way to modify my expression to do so?