04-15-2010 02:03 AM
Hi,
I am using a PCI-6602 card in my application and I am using all 8 counter input channels for counting edges of PWM signals.
Everything works fine except for one thing. It is essential that the counting of all 8 channels starts simultaneously.
I know that I have to use the "ArmStartTrigger" property of the respective channels to achieve that. But I don't know what would be the best "Source" for it.
As the measurement system is already at the customer's site, it will be difficult to change/add hardware. I.e. a software only solution is preferred.
The manual of the 6602 reads: "The Arm Start Trigger may be an internal or external signal".
What internal signals are available on the 6602?
Can any of that internal signals solve my problem?
I know e.g. that a 6250 card can utilize "ai/StartTrigger" as trigger source to synchronize analog input tasks with other tasks. Is there something similar for the 6602?
Regards,
Udo
Solved! Go to Solution.
04-15-2010 11:14 AM
If I recall correctly the DIO_0 pin doubles as PFI_0 which can be used as an arm start trigger source.
1. Create a simple on-demand DO task for DO_0. Write a "F" to it to set it Low.
2. Configure all your counters to use a rising edge on PFI_0 as an Arm Start trigger, and start them.
3. Write a "T" to the DO task to create the rising edge. (I would then write a "F" before stopping the task. I just figure it's a good habit to make both edges explicitly so if I decide in the future to react to a falling edge, it's one less thing to have to go back and change.)
-Kevin P
04-16-2010 01:43 AM
Thank you for the fast reply.
I didn't come to the idea to use a PFI-line as start trigger (which is then an input for the counter tasks) and then write to that PFI-line as digital output. Still sounds strange, but if it works
Just to summarize (in C#, easier to write in a message)
I will configure all counter tasks with PFI0 as ArmStartTrigger (Rising):
TaskPWM1.Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger(PWMDev + "PFI0", DigitalEdgeArmStartTriggerEdge.Rising);
TaskPWM2.Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger(PWMDev + "PFI0", DigitalEdgeArmStartTriggerEdge.Rising);
:
After starting all counter tasks, they are waiting for the trigger to actually start counting. Now I will do exactly that in a seperate thread:
Task StartTrigger = new Task("StartTrigger");
StartTrigger.DOChannels.CreateChannel(PWMDev + "port0/line0", "", ChannelLineGrouping.OneChannelForEachLine);
DigitalSingleChannelWriter StartTriggerWriter = new DigitalSingleChannelWriter(StartTrigger.Stream);
StartTrigger.Control(TaskAction.Verify);
StartTriggerWriter.WriteSingleSampleSingleLine(true, false);
StartTriggerWriter.WriteSingleSampleSingleLine(true, true);
StartTriggerWriter.WriteSingleSampleSingleLine(true, false);
StartTrigger.Dispose();
StartTrigger = null;
That should work, isn't it? Do you think I need a waiting time in between the 'F', 'T', 'F' writings?
Regards,
Udo
04-16-2010 12:19 PM
The basic idea looks right. I can't vouch for the syntax on C# calls to DAQmx because I'm strictly a LabVIEW guy, but I don't see anything that looks out of place. I doubt you need any waiting time during the F-T-F sequence. The board hardware will be triggering off a transition edge and software calls through the driver to change the digital state will probably each take a few microsec or more.
-Kevin P