NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Armando83
Posts: 33
0 Kudos
Accepted Solution

Continuous Digital Output from the PCI-6259

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.

Member
Josh_B1
Posts: 116
0 Kudos

Re: Continuous Digital Output from the PCI-6259

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
Member
Armando83
Posts: 33
0 Kudos

Re: Continuous Digital Output from the PCI-6259

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.

Member
Armando83
Posts: 33
0 Kudos

Re: Continuous Digital Output from the PCI-6259

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

 

Thanks!

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page