Dear NI forum members,
We just got a NI PXIe-1073 Chassis with a NI PXIe-6361 switched in PXI1Slot2 and a shielded connector box BNC-2111. Aim is to generate three TTL pulse trains to control a laser, a sound and a shock via Matlab Application. I use the NI-DAQmx C API together with Matlab MEX to integrate the C code in Matlab.
I came up with the following code from the C examples to generate a finite time-based TTL pulse train:
float64 initialDelay; float64 lowTime; float64 highTime; uInt64 periodsPerTrain; float64 taskMaxTime = (lowTime+highTime)*periodsPerTrain + 2*initialDelay; // Configure Pulse DAQmxErrChk(DAQmxCreateTask("", &taskHandle)); DAQmxErrChk(DAQmxCreateCOPulseChanTime(taskHandle, "PXI1Slot2/ctr0", "", DAQmx_Val_Seconds, DAQmx_Val_Low, initialDelay, lowTime, highTime)); // Configure Pulse Train DAQmxErrChk(DAQmxCfgImplicitTiming(taskHandle, DAQmx_Val_FiniteSamps, periodsPerTrain)); // Start Train DAQmxErrChk(DAQmxStartTask(taskHandle)); // Wait for execution DAQmxErrChk(DAQmxWaitUntilTaskDone(taskHandle, taskMaxTime)); // Clean up DAQmxStopTask(taskHandle); DAQmxClearTask(taskHandle);
I am stuck with two problems:
1.) PXIe-6361 has 4 counter signals ctr0-3. With the above code, I can generate separate tasks for each TTL signal and evoke them consecutively with DAQmxStartTask. But in that case I guess the tasks are not synchronized. Can I use the forth clock signal to synchronize the other 3, so the tasks on each is triggered at the same time? What will be the right way to do that with the C API? The smallest discrete time step in the exapmle is 500ms. See the attached image to check how the TTL signals should look like.
2.) What is my physical connector on the BNC2111 to outsource those signals.
/PXI1Slot2/ctr0 -> PFI12/P2.4
/PXI1Slot2/ctr1 -> PFI13/P1.0
but what about ctr2 and ctr3? how can I set the outsource physical connector? Is there a function to specify that?
Thank you in advance for any tips, suggestions and direction!
cheers,
go9kata