From 02:00 AM CST Saturday, February 4 - 06:00 AM CST Saturday, February 4, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Digital Output from the PCI-6259

Solved!
Go to solution

I'm trying to generate a continuous four-bit digital signal (16 samples) from a PCI-6259 that I'm trying to have look like the output of a four-bit counter (0 to 15) from P0.0, P0.1, P0.2, and P0.3. I have no problem creating the task in Measurement and Automation (see attached screenshot).

The issue I'm running into is that I'm not sure what Write function I ought to be using to get my DAQ to go. I've tried using DAQmxWriteDigitalLines and that didn't seem to get me anywhere.

 

FWIW, here's a snippet of code I've tried to get to work to no avail. My thought is that I could repeat this process for 0 to 15.

index = 0
                    For i = 1 To highPoints
                     writearray1(0) = 0
                     writearray1(1) = 0
                     writearray1(2) = 0
                     writearray1(3) = 0
                     index = index + 1
                     publicStatus = DAQmxWriteDigitalLines(publicDigitalOut0TaskHandle, DACwaveFormSize, True, 5, DAQmx_Val_GroupByScanNumber, writearray(0), publicSampsPerChanWritten, ByVal 0&)
                    Next i

 Am I doing anything wrong? I would greatly appreciate whatever help the community could give.

0 Kudos
Message 1 of 4
(6,002 Views)

Hey Armando,

 

I noticed that in your code you may referencing the wrong array. You create "writearray1" and then reference writearray. Was this intentional? Also if you go to start>all programs>national instruments>NI-DAQ>Text-Based Code Support you will find the NI-DAQ™mx C Reference Help. You may find this resource useful.

 

Regards,

 

Josh Brown

Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(5,991 Views)

I actually corrected that in the (simplified) code, and I wound up getting an overflow error. FWIW, I've got a 20 kHz pulse train driving PF01.

 

writearray(0) = 1
writearray(1) = 0
writearray(2) = 0
writearray(3) = 0
publicStatus = DAQmxWriteDigitalLines(publicDigitalOut0TaskHandle, DACwaveFormSize, True, 5, DAQmx_Val_GroupByScanNumber, writearray(0), publicSampsPerChanWritten, ByVal 0&)

 What I'll do after the long weekend is check out some of the tutorials to see if they can point me in the right direction.

0 Kudos
Message 3 of 4
(5,978 Views)
Solution
Accepted by topic author Armando83

It took me a little while, but I was able to adapt the code from DAQmx Dig Write tutorial for my project.

 

Thanks!

0 Kudos
Message 4 of 4
(5,953 Views)