Discussion:
Sending digital output to the right pins
(too old to reply)
Stim0r
2006-10-25 19:10:13 UTC
Permalink
After reading a bunch of examples, I got this
program to run correctly....but only on channel 0 (P0.0, the first
digital channel).  I am using a PCI-6221 to output a square wave of N
samples, using an array as an input.  It works perfectly on
dev0/port0/line0, but not for anything else.  Can you please tell me
what I'm doing wrong?  I can use the Digital IO examples to write data
to the channels, which I can measure using an oscilliscope, but i'm
missing something here.  I'm
wondering if the 10kHz counter i'm using is only being sent to
/dev0/port0/line0 (P0.0).  Is there a way to multiplex this to the
other digital out pins, or even better, to the digital I/O pins (PFI
series of pins)? Or is the problem occuring because i'm not using one
of the MHz counters?Thanks,Steve


Trig8_100kHz.vi:
http://forums.ni.com/attachments/ni/70/5699/1/Trig8_100kHz.vi
Nicholas B
2006-10-26 19:40:10 UTC
Permalink
Hi Steve,
I've taken a look at your VI and made some modifications.  I attached it to this post...please take a look.  Here are the changes I made:
1.  I replaced your "Channel" string control with an I/O selector control.  This allows you to choose which port(s) or line(s) you want to write to from a drop down menu.  This was accomplished by deleting the string control and then right-clicking on the lines input terminal and selecting Create » Control.
2.  I changed the source of your sample clock.  It now comes from a counter output on the same board.  I used and example program to generate a pulse train on a specific counter, and then I told your program to look at this counter for its sample clock.  The example program I used was named "Gen Dig Pulse Train-Continuous.vi" and is located in the NI Example Finder under Hardware Input and Output » DAQmx » Generating Digital Pulses.  On the front panel of this example, just choose a counter, a frequency and a duty cycle...then be sure to take your sample clock from the same counter in your VI. 
3.  I changed the polymorphic instance of the DAQmx Write VI.  You had it set for Digital » Multiple Channels » Multiple Samples » 2D U32.  Since "one channel for all lines" was chosen for the line grouping input of the DAQmx Create Channel VI, the polymorphic instance should not be specified for Multiple Channels, but rather Single Channel.  In the modified VI  you will see that I changed the polymorphic instance to Digital » Single Channel » Multiple Samples » 1D U16.  In this configuration, the program will write the first element of the array to the digital line, then write the second element of the array to the digital line, then the third element and so on.  Thus the line will basically retain the last element in the array. 
If you wish to write to multiple lines at the same time, you can take a look at the "Write Dig Chan.vi" (or "Write Dig Port.vi") example VI which performs a continuous acquisition inside a while loop.&nbsp; The polymorphic instance is configured for Digital »&nbsp;Single Channel »&nbsp;Single Sample » 1D Boolean.&nbsp; Also <a href="http://digital.ni.com/public.nsf/websearch/1B63CEAF2FA6A2AA86256D1F006DEC31?OpenDocument" target="_blank">this KB</a>&nbsp;describes the polymorphic instances and when to use them with particular line grouping input selections.&nbsp;
Hope that helps.&nbsp; Please let me know if you have any additional questions...
Regards,
Nicholas B, National Instruments


Trig8_100kHz_modified.vi:
http://forums.ni.com/attachments/ni/70/5705/1/Trig8_100kHz_modified.vi
Nicholas B
2006-10-30 17:10:11 UTC
Permalink
Hi Steve,
Attached you will find the VI saved for LabVIEW version 8.0.&nbsp; Please take a look and let me know if (a) it still does not work or (b) you have any additional questions.&nbsp;
Thanks and have a great day!
Regards,
Nicholas B, National Instruments


Trig8_100kHz_modified_LV80.vi:
http://forums.ni.com/attachments/ni/70/5713/1/Trig8_100kHz_modified_LV80.vi
Loading...