DAQ with NI USB card - Continuous output with 20KHz update rate in SIMULINK?

5 views (last 30 days)
Hello everybody,
I want to use use my National Instruments USB DAQ card (NI-USB 6356) to generate a continuous sinusoidal output in Simulink. In particular, a sinus with 200Hz Frequency, at a sampling rate of 20000 Hz. According to NI, the board should be able to cope with 1.25 Megasamples/sec. However, when I generate a 200 Hz wave in Simulink using the discrete-time wave generator, and connect this block to aDAQ toolbox analog output, the output signal at the board is not continuous at all: sometimes it manages to output an entire period, but most of the time the signal is erratic and anything but continuous... could this be a buffering problem? When I insert a buffer block before the analog output, the output wave stops at regular intervals ( ca. 1sec), stops for 0.2 seconds and and restarts again...
  1 Comment
Markus
Markus on 27 Sep 2013
Ironically, if I add a buffer block in order to queue samples before handing them over to the output, the break time scales linearly with the buffer size. Using a large buffer, I get a few seconds of continuous signal output and then one or more seconds of "nothing"....

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 26 Sep 2013
As a general statement, unless programmed otherwise at the driver level, virtual serial ports over USB have a 0.2 second buffering time -- a data packet will not be transmitted until it is full or until 0.2 seconds have elapsed with no further data.
USB driver code can override this and request that a partial packet be sent as soon as feasible, but MATLAB does not provide an explicit interface to that function.
I have no information as to whether the NI interface knows to use that "push" mode or under what circumstances: I am speaking of the way USB was designed to operate by default.

Categories

Find more on Analog Input and Output in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!