Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing and reading at high frequency with USB 6259, using C#

Hello,
 
What is the best way to generate and retrieve digital signals with USB 6259 using C# (VS2005), while maintaining high frequency (about 1nanosecond per command)?
The generate and retrieve commands are mixed up, so a simple waveform doesn't seem to work...
 
Thanks, Andrei.
0 Kudos
Message 1 of 8
(4,207 Views)
Hi Andrei,

According to the USB-6259 specifications the Timed Digital Input and Output can only go up to 1Mhz. This translates to 1 microsecond sample periods - is this acceptable for you application?
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 2 of 8
(4,199 Views)
Hello Abhinav,
 
Actually, that rate will suffice. However, our challenge now is to mix up the generated and the retrieved signals together (not a single waveform).
 
Andrei.
0 Kudos
Message 3 of 8
(4,193 Views)
Andrei,

Have you tried any of the examples that come with the NI-DAQmx driver? If you browse to the C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0\Digital directory in your computer you will find examples on generation and acquisition of static and timed digital signals.

The ContWriteDigChan_Burst example and ContReadDigChan_ExtClk example are what you are looking for. However you will have to modify these examples to use a sample clock from another source (none of the M series have a clock for digital I/O). What you can do is create a clock using a 'dummy' analog input task that does not read any values but instead just creates a sample clock for your digital I/O operations.

I would use these examples as a starting point to creating your example. Please let me know if this helps.

Thanks,
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 4 of 8
(4,170 Views)
Hello,
 
Thanks for your reply.
 
We have looked into the examples provided with the NI-DAQmx, however many of them are not applicable with USB-6259 (stuff like PatternMatch and the detection of raising and falling lines).
 
Did you mean to use ContWriteDigChan_Burst and ContReadDigChan_ExtClk simultaneously? How to synchronize between the reading ang the writing in that case?
 
Thanks,
Andrei.
0 Kudos
Message 5 of 8
(4,095 Views)
Hi Andrei,

Yes, he is talking about combining the two examples into one program.  Then you can add in an analog input task that doesn't read anything, but instead use the sample clock from that analog input task for the sample clock for the digital input and output tasks.  You will want to make sure that you start the digital in and digital out tasks before starting the analog input task so that both the digital in and digital out will start at the same time that the analog input starts. 

This works because the sample clock for the analog input does not start until you start the analog input task.  You can start the digital input and output tasks, but nothing will happen since there is no sample clock.  Once the clock signal starts, then the digital input and output tasks will start and since they are using the same clock channel, they will start at the same time.


Thank You,

Nick F.
Applications Engineer
0 Kudos
Message 6 of 8
(4,059 Views)
Andrei,

To add to what Nick said, you can find an example of the Analog Input task in the following directory on your computer:

C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0\Analog In\Measure Voltage\ContAcqVoltageSamples_IntClk\cs

This will show you how to read from the analog input but you do not neccesarily need to read, just setup the task and run it. You will need to use the ConfigureSampleClock method to specify the aisampleclock as the source for your digital input and output tasks.

Please refer to the NI-DAQmx .NET reference in the Start Menu for more help (Start >> Programs >> National Instruments >> NI-DAQ >> NI-DAQmx .NET Framework 2.0 Help)

Let us know if you need anything else!

Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 7 of 8
(4,050 Views)

Thanks for your help!

I will try that...

0 Kudos
Message 8 of 8
(4,038 Views)