Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital waveform output

hello everybody

first of all: i'm working with m-series card pci 6259 and measurement studio c++.

i want to output digital waveforms to sixteen digital outputs.
the waveform buffer should contain at least 720 points.
the frequency at which the output should be changed is varying between 24kHz and 120kHz.
when one waveform buffer is done, it must be recalculated, frequency adjusted and output again, and so on...

in the data sheet of my card i read about waveform characteristics of port 0. but i can't find any
documentation about this anywhere.

so can anyone help me with this problem?

regards
markus
0 Kudos
Message 1 of 11
(5,193 Views)
Can you please be a bit more specific what exactly you want to know?

"in the data sheet of my card i read about waveform characteristics of port 0. but i can't find any
documentation about this anywhere."

What specific information about the waveform characteristics are you looking for?

Best regards,

Jochen Klier
National Instruments Germany
0 Kudos
Message 2 of 11
(5,178 Views)
well that's not that easy to explain 😉 but i'll try...

i'm not sure if i understand this chapter in the data sheet of my PCI-6259 card right (chapter about digital i/o, waveform characteristics)
can i use a fifo buffer with up to 2047 samples and write those samples with a frequency up to 10Mhz?
can i use 2047 samples for each line or the entire port?

what i want to do now, is create a buffer with, lets say, 1000 samples for 16 digital output lines. so i have 16 different buffers.
After these buffers are output once, i'll have to recalculate the buffer and output frequency and write the buffers again.
is this possible, and if yes, can you give me a short explanation to this?

i hope my problem gets clearer now...
thx
markus
0 Kudos
Message 3 of 11
(5,178 Views)
Ok, so let's clarify this a bit. The PCI-6259 provides 48 digital I/Os, 32 of them (port 0) can transfer data based on an external hardware clock (up to 10 MHz). The hardware clock can be either generated by a counter or you can correlate the digital input/output operations to the clock of another task like AI or AO.

The FIFO is used by the board to buffer latencies of the PCI bus. In general you shouldn't have to deal with the FIFO size. Data is transferred to and from the board using DMA. In your application you can create a buffer for our DO data in the RAM of the PC that's much bigger than the size of the FIFO. The NI-DAQmx driver takes care of the DMA transfer to the board.

In waveform mode you don't work with single buffers for each line but you need to work with a single buffer for the whole port. So if I come back to your example (1000 samples for 16 lines) you will need one buffer containing 1000 integer values representing your line states. All lines will be updated synchronously.
I'll stick with this example for a while. Please consider if you only have a buffer on your PC with 1000 samples and you run your digital waveform generation with 10 MHz you will have to recalculate the buffer every 100 µs. This is way to fast for PCs available nowadays so you should either reduce the update rate or increase the buffer size.

Please take also into consideration that running 32 digital lines with 10 MHz means a data throughput of 40 MB/s on the PCI-bus. Depending on the chipset and other tasks that need to run on the PC you may or may not reach this speed.

I hope this helps.

Best regards,

Jochen Klier
National Instruments Germany
0 Kudos
Message 4 of 11
(5,171 Views)

thx again jochen.

well, at first, i don't have to generate the data at 10MHz, the max. generation rate will be about 100 kHz.

as i understand you, i have to update all 32 lines of port 0 synchronously? does that mean all lines have the same state at every moment?

or can i somehow shift my output buffer on different lines, that would help too.

and i can't leave some lines untouched, because they are used by another part of my program?

 

regards

markus

0 Kudos
Message 5 of 11
(5,167 Views)
Markus,

you need to update all clocked lines simultaneously. That's because there is only one DMA channel that can be used to transfer data from the PC to the digital output section of the board and you can't add some bits dynamically to this data transfer.

You don't need to use all 32 two lines of port 0 for this transfer. E. g.  If you use only 18 lines (Dev1/port0/line0:17) you still can access the 14 lines that are left in the port as static I/Os.

I hope that helps.

Jochen Klier
National Instruments Germany


0 Kudos
Message 6 of 11
(5,159 Views)

so does every output line have the same state at every moment?

how can i output different waveforms for each line?

 

0 Kudos
Message 7 of 11
(5,152 Views)
No, what you do is to pass an array of integer values to the write function. Every bit of each integer represents the state of one line at one moment.
Please refer to this example.

Jochen

0 Kudos
Message 8 of 11
(5,149 Views)
i'm a nerve-saw, i know 😉
 
unfortunately i don't have LabView installed.
 
ok, i have an array containing 16 values for my 16 lines e.g.
but i need to have a matrix of values, don't i? in my example a 16x1000 matrix, 1000 samples for each of the 16 lines. is there a function
which can output this the way i like to?
 
markus
 
 
 
0 Kudos
Message 9 of 11
(5,144 Views)
Again: no. You only need a 1D Array of integers. Each bit of one integer represents the state of one output line. Thus the first element of the array contains the states for all lines for t0, the second element contains all states for t1 and so on. Please have a look at the attached screenshot which might clarify this.

Jochen



0 Kudos
Message 10 of 11
(5,139 Views)