05-03-2017 09:48 AM
Hello,
while getting familiar with my NI6612 and C# something is really confusing to me. As far as I understand each digital line can only I/O a boolean state while counters are able to create/measure pulsetrains. According to the manual, I am allowed to use a PFI line as an external trigger for my actual pulsetrain created by the counter. Now what does that mean and how do I carry this out?
For example: In NI MAX I sucessfully created a task on PFI1-Line where I just tell MAX the desired type (continious, finite pulses, etc.) and frequency and I get an actual pulsetrain out of this PFI1-line which is even physically measureable. However looking inside the c# examples like "WriteDigChan" it asks me for some sort of data array with 8 boolean inputs. I do not understand what this dataArray is actually good for nor understand the errors I get which are stating discrepancies between "Number of Lines in Channel" and "Number of Lines in data" as I actually try to adress only PFI1 and no other line (or channel). Additionally I can say, that the NI MAX testpanel confuses me in the exact same way as the C# example when it asks me about "all high" or "all low". I guess I have a deep lack of understanding regarding how NI MAX actually outputs a pulsetrain (digital waveform) on PFI1 and what it is actually internally doing.
Please consider, that I don't want to use and occupy a second counter just to trigger my first counter pulsetrain if avoidable. Thank you in advance.
05-04-2017 09:09 AM
I only program LabVIEW so I'm no help with syntax for the text language driver api. Here's some general comments I hope can help.
DAQmx maintains a clear distinction between Digital tasks and Counter tasks, even though both involve the same kind of signals at the pins. Many of the pins available for DIO are *also* eligible to be routed as timing signals. These are labeled PFIx where x is a number starting from 0.
You'll be able to configure a counter pulsetrain task that is triggered off a PFI line. If you choose a PFI line that's also eligible for digital output, you can generate a triggering pulse with a digital output task. I suggest you start the digital task first and set the value low, then start the counter task, then toggle the digital line high then low.
-Kevin P