Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital I/O Handshaking with DAQmx using VB.NET

I am new to both Visual Basic and using the DAQmx driver. I want to output a vector N times and input the results to test against expected values at as high a rate as possible. I think I want to load my initial vector into the onboard memory once and then just reread it using a handshaking protocol with one port as an output and one as an input.

It seems like this example: http://sine.ni.com/apps/utf8/niepd_web_display.display_epd4?p_guid=B45EACE3EDC356A4E034080020E74861 would get me started, but it is geared towards VB6.0 and uses Traditional DAQ (Legacy). Can anybody pass on a suggestion or point me to a more up to date example? Any help would be appreciated. I am trying to get up and running on this. Thanks.
0 Kudos
Message 1 of 5
(2,961 Views)
Hi Max,

You should be able to find a lot of DAQmx Digital I/O examples in the following path:
C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C

Not too many of them are geared specifically for handshaking, but it should give you a good idea how it all works in DAQmx.  Then you can do all the specifics like make a finite output, read back near the max rate for your board, etc.

If you need any extra help, make sure to let us know what hardware you are using.

Regards,
0 Kudos
Message 2 of 5
(2,948 Views)
I am using the PCI-6534 with VB.NET and attempting to utilize the DAQmx. I am new to all of the above. Do you know of any more direct examples or could you give me some guidelines for converting the code over? Thanks.
0 Kudos
Message 3 of 5
(2,931 Views)

Max,

We also have some VB.NET specific examples that I recommend taking a look at.  If you have Measurement Studio, some examples should be installed by default in the C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples directory.  There are also many examples posted online, which you can search for through the Example Code Library.  I found one example to get you started:

DAQmx - Continuous Read Digital Channel in Burst Mode - LabVIEW - CVI - ANSI C - VB.NET

I hope this helps!

Thanks,

Justin M.
National Instruments

0 Kudos
Message 4 of 5
(2,919 Views)
Thanks for the referral to that code. I think I understand the basics of it but I am having problems implementing a reader and writer at the same time.

I am trying to have the reader input its data on the falling edge of the clock and the writer output on the rising edge. These are just sample clock settings I believe, I encounter problems when I try to get them to occur at the same time. I have thought of a few ways that might work but I was just looking for a recommendation and maybe some clarifications on which are more feasible for a write that loops N times.

So here are what I've thought about/tried implementing:
-assign the reader to autostart and let the writer run with an async callback. in the async callback, save the read values to a file and then start the read again, incrementing a variable until the N loops is reached

-have the reader and writer in separate async callbacks, but might the reader lose some samples when saving to the file?

-have both run in the background using a background worker with a large buffer size of (number of samples)*N [which will likely exceed the 2x32MB onboard buffers] and have the reader loop its data and use a counter to tell it to stop [not sure how to implement a counter on a continuous write]

let me knowif any of thse are feasible or if you have any other suggestions...or if i am unclear. thanks.
0 Kudos
Message 5 of 5
(2,885 Views)