Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

need help on USB 6008

Hi Tao,

1) When I write the case-structure, I assume that the output should be: both lines are low for 100ms, then one high for 300ms, then both low for 100ms, then the other high for 300ms. However, when I look at the results in the graph indicator reading from the analog input connected with the digital output, I find that things are different from what I expect: both lines are low for 100ms, and then one high for 200ms, then both low 100ms, then the other high 200ms. Am I understanding the case-structure wrong?

This is due to the fact that we are using the wait until next ms multiple and not the wait vi.  The wait until next (ms) multiple uses the CPU clock to clock the loop.  For example, when you start that you want both low for 100ms using this command it will wait in 100ms multiples of the CPU clock.  When you state in the second case that you want it to wait 300ms it sets it so that it will wait in 300ms multiples of the CPU clock.  What happens in the second state is that since it has already waited 100ms for the first state it only has to wait 200ms more to meet the next 300ms multiple from the starting point.  What you can do to fix this problem is use the Wait vi instead of the wait until next ms multiple.

2) Now I am using a separate while-loop to output the series of 0's and 1's, and the period is 600ms (not 800ms I used to expect). I found that if I put the case-structure in the for-loop, I would not get the non-overlap clocks I want. However, if I want the non-overlap clocks stop to generate once all the data I want to inject the scan-chain have been injected, what should I do to control the two while-loops?

This should be fixed by the first question's answer.  You can still use a for loop you just need to set the number of iterations to the total amount of clock pulses required to send all the data.  I recommend setting this to a number higher just to guarantee that all the data is sent.

3) When I use this USB-6008 to inject digital numbers into my device, need I make them common grounded? 

Yes, it is always a good idea to maintain a common ground between devices in a test system.  I would take a look at the field wiring and noise considerations for analog signals article, found here.  Although this is for analog signals, many of the same concepts apply to digital signals as well.

I hope this helps,
Paul C.
0 Kudos
Message 11 of 20
(1,604 Views)
Thanks, Paul. It is very helpful. Now I have sovled almost all the problems with non-overlap clocks generation.

But another problem occurs. Since I want to inject up to 500 numbers (0's or 1's) into my scan-chain, I certainly do not want to write all of them in the 'constant' box. I hope I can write this 500 numbers in a file, then LabVIEW can read from this file and output them as data. However, after I read the examples such as 'Read from text file' or 'Read from binary file', I think they are not what I want. So, could LabVIEW provide a way so that it can read from, say, one column of .xls file, and output them one by one? Thanks!

-Tao
0 Kudos
Message 12 of 20
(1,574 Views)
Hi Tao,

I would recommend trying the read from spreadsheet VI.  If you have a .xls file, I would just open it up in excel and use the file » save as to save it as a text file.  This will make things easier.  For example, I made an excel file with 1 column and 500 rows of the numbers I wanted to output.  I saved the excel file as a text file.  I was then able to open the text file within LabVIEW.  I used the read from spreadsheet vi and transposed the data so that all the data was contained in the first row.  I've included a picture of the code that I used.  This will take one column of data and bring it in as one row to be used with your code.  The true constant is wired to the transpose pin on the bottom of the read from spreadsheet VI.



I hope this helps,
Paul C.


Message Edited by Paul C. on 11-29-2007 10:28 AM
0 Kudos
Message 13 of 20
(1,555 Views)
Thanks, Paul. It is very helpful. Smiley Happy
0 Kudos
Message 14 of 20
(1,544 Views)
Hi Paul,
 
Sorry to bother you again after so long a time that I guess you already forget what we were talking about before. Basically, I was using LabView and USB-6008 to build a scan chain, which could creat two non-overlap clocks and input a data to my chip every 600ms. It works fine and thanks to your previous kind help. Now I have another question:
 
Previously I input a series of data into my chip every 600ms, and when I tried to increase this data rate by 2 or 10, I found the timing of the two non-overlap clocks were not accurate enough (jitter is large) therefore I just accepted the slower data rate. However, now when we are going to test another chip, this data rate seems too slow because we want to input many data for many times.
 
I noticed that you said USB-6008 was software timed and "the accuracy of a software timed clock is system dependent and may not be possible at millisecond or faster speeds". What do you mean by saying "system dependent"? Is it a "computer system", or "NI DAQ system"? How can I learn the fartest data rate I can achieve? What if I want to increase the data rate? Need I upgrade my computer, or buy another NI DAQ which is hardware timed?
 
Another thought is that if I use the "Timed loop" or "Timed sequence" structure, will it be more accurate in time domain than the "Case structure" with "wait" or "wait until" block?
 
Thank you very much,
Tao
0 Kudos
Message 15 of 20
(1,389 Views)
Hi Tao,

What I meant by system dependant is that the speed of your computer can greatly impact the speed that you can do a software timed generation / acquisition.  If you need faster than millisecond speeds, my recommendation would be to look at purchasing a card that can do hardware-timed generation or acquisition.  If you have set data you need to input into your chip, you can load and send that data to a hardware-timed digital I/O line to output it as fast as the timing engine on the card can handle.  This will also help considerably with issues of "jitter".  The other problem with software timed acquisition is that you have to wait for your computer processor to handle each event.  Sometimes, when the computer is busy, it takes longer to handle this event.  This creates "jitter" in a changing generated signal.  

"Another thought is that if I use the "Timed loop" or "Timed sequence" structure, will it be more accurate in time domain than the "Case structure" with "wait" or "wait until" block?" 

I don't forsee any improvement.  It should be about the same.

I hope this helps,
Paul C.
 

0 Kudos
Message 16 of 20
(1,367 Views)

Hi Paul,

Thanks for quick reply. Could you recommend some NI DAQ card which is hardware-timed? I tried to search them in NI USB DAQ products but failed to find any. Thanks.

-Tao

0 Kudos
Message 17 of 20
(1,364 Views)
Hi Tao,

All of the USB M-series cards support hardware-timed Digital I/O.  One example of this is the USB-6229 which can be found here.  The important note is that they do not have their own devoted Digital I/O timing engine.  This means that you will have to use the Analog Input, Analog output, or counters to generate a clock for your digital operations.

I hope this helps,
Paul C.
0 Kudos
Message 18 of 20
(1,362 Views)

Thanks, Paul. I talked to my advisor and he agreed we would buy another NI DAQ card. I really appreciate your continuous help on my work.

 

Here is another question for "scan out". Basically, it is similar to "scan in". We built a series of registers in the chip, and driven by two non-overlap clocks rating at 200ms per cycle, these registers output a series of data (could be '0' or '1') one by one from a single pin. So every data will be held on the line for about 200ms.

 

Now I want to use USB-6008 to read these data in the Labview, and for test purpose, I just connect the output and input lines together. You can see from the vi file which I will attach in this post, I use line0 and line1 of port0 to output the non-overlap clocks, and use line2 of port0 to output a series of data. For simlicity, I create a spreadsheet file of 0s and 1s every other row. To view the waveform, I connect those 3 lines to analog input lines ai0, ai1 and ai4. To test scan out function, I connect line2 of port0 to line0 of port1, and use line0 of port1 to input the data appearing on its line and write those values into another spreadsheet file.

 

It would be simple to just use software timed sampling, reading the digital input every 200ms. And since I want to sample when the data is settled, I use a "stacked sequence" to wait for 100ms before sampling and then wait for another 100ms. In this way, I believe the sampling will always be done at the midpoint of a data if the input and output tasks are started simultaneously. However, when I run the vi file, I find sometimes the output and input are the same, while sometimes are not.

 

Since I view from the virtual oscilloscope the output is what I want, I can only guess that the output and input task are not simultaneous, so that the sampling is being done at the edge of data and errors are casused. To verify, I output a spreadsheet file of all '1's or all '0's and such errors never happen (because actually there is no rising/falling edge now).

 

So my question is, how to make those 4 tasks start simultaneously? I tried "flat sequence" and put those 4 "start task"s in one frame, but it seemed not to work.

 

I know the best way to do the sampling is to use ck1 or ck2 as an external clock, and make the digital input to read the value every rising or falling edge of such clocks. However, it seems that USB-6008 does not support external clock? I want confirm it with you. And I also tried many other ways such as "change detection" or "triggering", but I failed all of them. So, could you tell me is there any ways to realize such function (sample at the rising/falling edge of clock) using USB-6008?

 

Thank you very much!

Tao

0 Kudos
Message 19 of 20
(1,331 Views)

Hi Tao,

 

The only way to gaurentee that the four tasks start at the same time is to use a hardware trigger that starts them all.   The problem is that the 6008 cannot use a start trigger on a digital task.  The 6008 is just not designed to do this type of operation.  Without being able to start them with a hardware tirgger, you're left with trying to start them in software at the same time.  The best way I can think of is the flat sequence structure as you have already tried.  Even the m-series cards I suggested would have difficulty with this type of application hardware timed because they only have one digital trigger system.  You might look at some of our Digital I/O cards that have multiple trigger lines for digital tasks.  This would allow you to hardware start both your digital output and digital input tasks on the same trigger.  There is one that that you might try.  From looking at your code, it looks like your only forcing the 100ms wait prior to the read on the first iteration of the for loop.  On subsequent iterations your doing the wait in parallel.  Try fixing it with the below modifications and see if it doesn't work better.

 

 

 

I hope this helps,

Paul C. 

Message Edited by Paul C. on 08-19-2008 12:36 PM
0 Kudos
Message 20 of 20
(1,321 Views)