03-29-2022 01:32 PM
I am writing a program in C# that controls hardware with fixed channel connections to a PCIe-6323 card. on one of the channels, P0.3, I need to generate a pulse train of 50Hz frequency at 2ms per pulse. From what I understand I cannot route a counter to a non PFI channel, so is there a way to do this or am I stuck here? I've seen many examples using DigitalSingleChannelWriter with ConfigureSampleClock, indicating that timing can be attached to non-PFI channels, but I can find nothing about how to send pulses instead of bytes. the timing is not extremely critical, as long as I am getting 50 pulses of ~100ms cumulative duration per second I should be ok.
03-29-2022 02:42 PM
I don't know the text language syntax, but this should be a Finite Sampling task at 1000 Hz with 100 samples. You'll just alternate your digital state between high and low every sample. Since you toggle every msec, you'll have a full pulse cycle every 2 msec.
You *might* have to write an array of 32-bit unsigned integers to the task, where each bit represents one digital line of your 32-line port 0. If so, 8 is the value that turns only bit 3 on. So your array would alternate between 8 and 0 to make your P0.3 pulses.
In LabVIEW, this is what you'd do if you configure the task to be "one channel for all lines". There's also an option for "one channel for each line", in which case I'd write an array of Boolean data types alternating between True and False to accomplish the same thing. (Under this config, the task knows that the single Boolean value should map only to P0.3)
-Kevin P