Discussion:
digital I/O on 6534 in C++
(too old to reply)
Doug M
2005-09-01 23:42:47 UTC
Permalink
rt,
Generally using the Traditional NI-DAQ C API you use the DIG_Block_In
to start the digitial input acquisition, whether you are doing finite
or continuous acquisition, and you do not have this function in any
kind of loop.  Within the loop you read samples off the
buffer.  There are quite a few examples that ship with the driver
that demonstrate various digital input tasks -- a good one to look at
would be C:\Program Files\National
Instruments\NI-DAQ\Examples\VisualC\Di\DIdoubleBufPatternGen653x.C.

However, I would highly recommend moving to our newer, much easier to
use API and driver, NI-DAQmx.  NI-DAQmx supports the PCI-6534 and
is available for free download on our website.  It too ships with
many examples on doing basic I/O functionality.

I hope this helps!

Doug M
Applications Engineer
National Instruments
rt_quantum
2005-09-01 23:42:48 UTC
Permalink
Doug,
 
thanks for your great answer, I have been playing with the double_buffer_pattern example and I need to read the chapter 4 in the DAQ manual to really understand exactly what the function in the loop is doing.
 
As far as the new NI-DAQmx, I have that installed as this card is brand new, but can't find the code samples, where are the code samples for NI-DAQmx?
 
thanks, ryan
Doug M
2005-09-02 16:43:23 UTC
Permalink
Ryan,
Assuming you did install the examples with your installation of
NI-DAQmx, the examples should be at: C:\Program Files\National
Instruments\NI-DAQ\Examples\DAQmx ANSI C\

I believe that you can select to install this support when you
initially install the driver.  If these files aren't present, put
in your NI-DAQ CD and modify the install, adding the examples and
support.

Doug M
Applications Engineer
NI
rt_quantum
2005-09-02 18:43:49 UTC
Permalink
Wow this is amazingly easier.  I'm right at the beginning of this application so I'm glad you told me to take a look at NI-DAQmx first.
 
I need to receive 32-bit packets at an external sample clock rate of 20kHz.  There are a number of places on the card where I can receive clock apparently.  But the documentation for DAQmxSampClkTiming( ) is rather vague on the source.  If I use the default from the example (PFI0), where does that correspond to on my 6534 card?
 
I have REQ1, REQ2, PCLK1, and PCLK2.  How do I specify that one of these should be my clock source?
 
Thanks for all your help,
 
Ryan
Doug M
2005-09-02 20:44:02 UTC
Permalink
Ryan,
The NI-DAQmx Help is a great reference here.  To get to it, go to
Start >> Programs >> National instruments >> NI-DAQ
>> NI-DAQmx Help.  Once the help file is open, you can see
the device pinouts for the PCI-6534 by going to NI-DAQmx Help >>
NI-DAQmx Device Terminals >> Digital I/O >> NI 653x. 
You can also see the pinouts for a device from Measurement and
Automation Explorer (MAX) by going to My System >> Devices and
Interfaces >> NI-DAQmx Devices >> (your board) then
right-click on your board and choose Device Pinouts.   This
will shows that PFI0 is pin 4.  There is also a table that shows
the equivalent names between Traditional NI-DAQ terminology and
NI-DAQmx terminology.  This can be found in the NI-DAQmx Help at
NI-DAQmx Help >> NI-DAQmx Device Terminals >> Terminal Name
Equivalents.  This mentions that REQx in Traditional NI-DAQ is
equivalent to PFIx in NI-DAQmx.  Hope this helps.

Doug M
rt_quantum
2005-09-20 23:41:14 UTC
Permalink
Doug,
 
Thanks this has been a great help.  I am using the Digital Pattern Recognition Start Trigger, and there doesn't seem to be any sample code showing how to do this (or am I missing it?).  Here is my bit of code that works, except for the start trigger part.
 
I'm sending the trigger pattern over the ports (it's a 32 bit pattern across "Dev1/port0:3") but the task times out, so I am not sure what is wrong.
 
 /*********************************************/ /*/ DAQmx Configure Code /*********************************************/ DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
 DAQmxErrChk (DAQmxCreateDIChan(taskHandle,"Dev1/port0:3","",DAQmx_Val_ChanForAllLines));
 DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI2",20000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,arraySize));
 
 DAQmxErrChk (DAQmxCfgDigPatternStartTrig (taskHandle, "Dev1/port0:3", "11000100000000100000010000110001", DAQmx_Val_PatternMatches));   /*********************************************/ /*/ DAQmx Start Code /*********************************************/ DAQmxErrChk (DAQmxStartTask(taskHandle));
 
 /*********************************************/ /*/ DAQmx Read Code /*********************************************/  DAQmxErrChk (DAQmxReadDigitalU32(taskHandle,-1,10.0,DAQmx_Val_GroupByChannel,data,arraySize,&sampsRead,NULL));
 
 
I feel like after this it should start taking data once it sees the pattern indicated above.  Is there something wrong here?Message Edited by rt_quantum on 09-20-2005 06:17 PM
Laura F.
2005-09-21 15:10:44 UTC
Permalink
Hi Ryan,
 
Since you are getting a timeout, it seems that the function call is setup correctly, but maybe that pattern is not actually being detected before your timeout of 10 seconds is up.  Could you start with only 1 port and using either all 1's or 0's for the trigger?  This way you can be more certain that the pattern is actually there. 
 
Thanks,
Laura
rt_quantum
2005-09-21 17:10:19 UTC
Permalink
Hi Laura,

So it is no problem to use port0:3 for my virtual channel and the same ports for my  pattern match trigger?

I get an error message that tells me that the specified lines may be
reserved or that the device is not present.  I'm sure that the
device is present, so that only leaves the lines being reserved. 
I'm assuming that's because I've designated them for use in my virtual
channel in DICreateChan()

If this is the case, can I use any other open line (like PFI3,4,5,6 etc..) for pattern matching?

Thanks,

Ryan
rt_quantum
2005-09-21 23:10:52 UTC
Permalink
FYI I tried to use the line PFI6 and matching the pattern "1" on this line and it errors out saying that the "specified channel is not in the task"
 
 
 
rt_quantum
2005-09-22 00:10:12 UTC
Permalink
okay I successfully start triggered from a 32-bit pattern on port0:3.
If it sees that same pattern again, will it start trigger again and start over?  Is there a way to stop trigger on a pattern?
Laura F.
2005-09-22 16:41:02 UTC
Permalink
Hi Ryan,
 
To change the timeout you actually change it in your read function DAQmxReadDigitalU32, not the trigger function.  You want to specify a timeout of -1 to wait indefinitely for the read to begin. 
 
When you configure a start trigger, the task will only trigger the first time the pattern is received.  You should look at the function DAQmxCfgDigPatternRefTrig if you want to implement a stop trigger (also known as a reference trigger). 
 
Hope this helps!
Laura
rt_quantum
2006-09-11 19:40:10 UTC
Permalink
Hello!

I've been using my PCI-6534 card successfully for about a year now, see
above discussion.  I've been taking data streaming from 32 pins
into my 6534 using a pattern to start trigger.  I need to modify
this system.

I now need to take this same data on only one pin.  ( so that the
data will be streaming in on one pin at 32X the current rate ). 
Current rate is a maximum of 140 kHz, so now the sample rate will be
32*140kHz =  < 5 MHz.  This should not be a problem
correct?  I believe 6534 is capable up to 40MHz?

Also, now instead of using a pattern to start trigger on 32 pins,
should I continue to use the CfgDigPatternStartTrig() function (and the
pattern will be "1" on one pin), OR should I instead be using the
function CfgDigEdgeStartTrig()?  If I use CfgDigEdgeStartTrig(),
to start taking data on the rising edge, can I also use this same pin
to get the subsequent data, or does it have to be a separate pin? 
( Currently I get 32 pin pattern on the same 32 pins that data comes in
after the pattern has started the acquire, does that make sense?)

thanks so much

Continue reading on narkive:
Loading...