08-16-2021 01:40 PM
The code I posted is only meant to *illustrate* some key points, not to be a complete end solution. I wasn't trying to think about your specific pin assignments, only trying to show how to export a counter output to one of the PFI pins that's allowed to be configured for output.
Note: a counter task is *not* a DO task. These counter pulsetrain tasks require the use of NO timing engines from the cDAQ chassis -- that's just one of the advantages of doing this with counter tasks.
In the code I posted, one counter pulsetrain is based on time, the other is based on an external signal (which can be an encoder) known as the 'source of ticks'. You can do things either way. (Actually, the time-based API is just a programming convenience. Internally, the counter always *really* works on Ticks. But when you don't specify an external 'source of ticks', it uses one of its own constant-rate internal timebases, and then it knows how to convert your timing specs into the Ticks it *really* uses.)
My advice:
- work on each element individually before trying to bring them all together. For example, configure just 1 counter pulsetrain that uses the encoder as its 'source of ticks' to generate pulses for your camera. Focus on just the camera until you're sure that the frames are synced to the correct CAD position.
- if the spark or injector pulses need to have pulse widths that are precise in time but with a start position that's sync'ed to CAD, you'll need a helper counter. (And if they're at different CAD positions, the earlier one may need to act as the helper for the later one.) The thread I linked in turn has a link to an earlier thread where I illustrated how to do this. You could extend the idea to make the 2nd counter act as a trigger for a 3rd.
-Kevin P
08-25-2021 11:14 AM
Hi Kevin,
It seems that all the troubles are caused by cDAQ-9178, so I moved away from it. Instead, I am using PCI-6251 with BNC-2110. I am awaiting PCIe-6351 though.
However, this time I am getting an error message -200452 and it looks like this error is related to capability of PCI-6251. Please have a look at the attached photo. I also searched on the internet to get better understanding but the general advice was that I need to specify the data transfer method for the troubled channels.
Is it really caused by the lack of performance of PCI-6251?
Kind regards,
Dongsu
08-25-2021 02:21 PM
A photo of an error message on your monitor doesn't give me much to go on.
Your 6251 M-series device should support the use of a digital start trigger for counter output tasks. It will *not* support it for counter input tasks, but none of our discussion to date has involved any counter input tasks. (Counter input tasks require the use of an "Arm Start" trigger that's only configurable with DAQmx property nodes.)
Run the code again to reproduce the error. Dismiss it, then go to your vi's menu and select "Edit->Make Current Values Default". Then save the vi and post it here.
-Kevin P