12-29-2007 06:24 AM
01-02-2008 10:19 AM - edited 01-02-2008 10:22 AM
Q1: There is not a concept of a Digital Chart yet in LabVIEW. However, you can get around this by using a shift register in your while loop, and append the previous waveform with the new waveform, and then plot the new waveform. There is a VI in the Digital Waveform palette for concatanating two waveforms called "Append Digital Samples.vi". This VI only takes a single DWDT, not a 1D Array of DWDTs, so you will need to put it in a for loop that indexes through each element of your 1D arrays. See attached screenshot.
Q2: The dynamic datatype in LabVIEW only supports the various types of Analog Waveforms, not digital waveforms. Also, the only LabVIEW graph that supports digital waveforms at this time is the Digital Waveform Graph. You can get around the histogram issue by following the suggestions made in the Q1 answer.
Q3: I agree that the file read/write functions are confusing with regard to which datatypes they support. Unfortunatly, digital waveforms are not supports by the file I/O VIs you are trying to use (even though the icon has a digital signal on it ). To save the data to a spreadsheet ascii file, you will have to convert the data to a spreadsheet string, and then save that string to file using the standard LabVIEW File I/O VIs. There is not an intuitive way to convert DWDT to ASCII, but there is a simple method to do it. First off, a DWDT is really just a 2d array of 0's and 1's. So fist you should convert your DWDT into a 2D array of U8, where each element represents a signal sample for one signal. Once you have the 2D array of 0's and 1's, you can use a control from the string palette called "convert to spreadsheet string", and pass it the 2D array. I've quickly created an example you can look at to get a reference for how to do this. Your situation is a little harder since you are using a 1D array of DWDTs, so I had to add a for loop that indexes each element (I also asssumed that each element of the 1D array only contains one signal).
Good luck,
Jared
01-02-2008 03:06 PM
01-02-2008 05:21 PM - edited 01-02-2008 05:21 PM
You are very close. I marked up your first screenshot showing where your errors are. You are not initializing the shift register with the correct datatype, you must use a 1D array of DWDTs, so the shift register has the same datatype as what you are using inside your while loop. That will get you running again.
Second, the 1010/data icon you mentioned is the "Get Waveform Component" unbundler. Looking at your other screenshot, it looks like you found it to get the "Y" data from the DWDT. Now just use it again to retrieve the data from the "Y" component. The unbundler is polymorphic and will adapt to the type of data wired into it (and the icon will change ).
The reason you are using the undundle functions is to get the root data from the waveform. A Digital Waveform is really a combination of a Digital Table (Y), a Timestamp (To), and a time interval (dT). A Digital Table (Y), is made up of a 2D array of U8s (data), and a 1D array of U32s (transitions). The 2D Data array has the 1's and 0's of the waveform. The first dimension of the array is the samples, the second is the signals.
Now onto the timestamp question. The DAQ VI is likely adding a timestamp to your waveform, and the graph is showing that value to you. If you right click on the graph and check the "ignore time stamp" item, the waveform will always start with 0, and count up by dT.
For the last item, you will already have the data in a spreadsheet formated string, so you will just need to add the row/column headers. Start by reading the LV help in regards to all of the functions and VIs in the strings palette. You will just have to do some tedious string manipulations to get the row/column header names added.
01-02-2008 05:24 PM
Hey, I found a forum post pretty quickly on how to add headers to a spreadsheet string. This would be a good read for you.
http://forums.ni.com/ni/board/message?board.id=170&message.id=10512&query.id=95854#M10512
01-03-2008 07:11 AM
01-03-2008 10:12 AM - edited 01-03-2008 10:14 AM
You are newer to LabVIEW than I had originally assumed. I want to just get you the VI but I don't have LabVIEW 8 or DAQ, so the screenshots were my best attempt at helping you out quickly. Since that is not working I'm in the process of getting LV 8 and DAQ.
In the meantime, let's talk through some of your issues. First the shift register initialization. Rather than you trying to redraw my screenshot, let's think through what you are trying to do. This will be a good LabVIEW exercise for you . The shift register needs to be initialized with an empty 1D array of Digital Waveforms. There are a number of ways you can do this. There are build array functions in the array's palette, there are constants that can be created on the block diagram, there are Front Panel controls that can be wired to the shift register, etc. In my screenshot I chose to create a front panel control that was a 1D array of Waveforms. I then wired that control to the shift register. I did that because I didn't realize the "empty waveform" VI that you are using existed in LabVIEW 8 ( I thought that was a LV 8.2 feature). I recommend you continue to use the Empty Waveform VI to create a single waveform, but you still need to create a 1D array of waveforms. In conjunction with the Empty Waveform VI, there are two different methods to do this using one of two different VIs from the array palette. Here begins your first lesson, can you find one of the 2 methods for building or initializing an array from a single data type value?
Now into your for loop. You are passing your 1D array of Digital Waveforms into the for loop. The For Loop is automatically indexing one element at a time from that array for you, and the For Loop will loop one time for each element in your array. This happens because when an array is passed into a For Loop, you can right click on that node and choose whether it is auto-indexed or just passed straight through. Now inside the for loop, you are getting the 2D array of digital values component from a single waveform. The first index of this 2D array is all of the samples for a signal channel, the 2nd index is all of the channels.Now you only want the samples for the first channel from the 2D array. That information is contained at the first index of the first dimension of the 2D array. Therefore you will want to index out a subarray from the 2D array. There is really only one array VI in the array palette for doing this. Can you find which on it is? In your screenshot I'm looking at your VI, you have chosen the incorrect one.
Reply back as soon as you've tried these two things. By then I should have found a LV 8 and DAQ installation.
01-03-2008 01:15 PM
01-03-2008 02:14 PM
01-03-2008 07:08 PM