02-09-2024 11:34 AM
I am trying to route the internal timebase 20 MHz clock as an input to a counter source on a M series PXI - 6289 card as shown below:
I want to also use a trigger to the gate to generate a 10 MHz clock on the output which I want to then use as a clock for a digital line (this is described on page 117 of the manual M Series User Manual - National Instruments (ni.com) as Continuous pulse train generation). I have been using MATLAB so far and cannot figure out how to connect the internal 20 MHz timebase to the source of the counter. I've tried using the addinput function, addoutput function, addtrigger function in different combinations, but run into issues like you can't add an input to an output counter, for example.
I'm open to using daqexpress, python, labview, or literally anything to achieve this. I also tried doing this in daqexpress and could not figure out how to access each of the counter terminals (for example, why can't we just have a counter object and be able to put signals into the input source, gate, etc... and measure an output??). If anyone could provide any guidance that would be tremendously helpful. Thanks a lot!
Solved! Go to Solution.
02-09-2024 01:29 PM
Here is an example of something I tried:
02-09-2024 01:47 PM
It's simpler to produce a 10 MHz output using the internal 80 MHz timebase. It's *possible* with the 20 MHz timebase, but demands more non-default config work to set up properly.
I can only help with LabVIEW though I strongly suspect Python would give you access to the needed config. Probably not DAQExpress though and maybe not Matlab either (over the years I've seen a number of threads identifying ways the Matlab API into NI's hardware is limited).
The good news is that it should be a pretty simple mod to one of the shipping examples named "Counter - Continuous Output.vi". I simply expanded the DAQmx Channel property node to add the top property 'CO.CtrTimebaseSrc' to the three that were already there. (I right-clicked to make it a "write" field rather than a "read" field, then right-clicked again to create a front panel control). On the front panel you can then select the 80 MHz timebase for your device and configure your trigger.
-Kevin P
02-09-2024 02:42 PM
Thank you so much for this! I also found this example which helped me understand the MATLAB approach (Generate Pulse Width Modulated Signals Using NI Devices - MATLAB & Simulink (mathworks.com)). It abstracts the notion of the counter and I am not entirely sure which timebase it is using behind the scenes to generate the desired output frequencies.
I also will look into your solution in LabView as I assume that is the less abstracted more straight forward way. My application is very sensitive to timing so I assume I might have to use this to synchronize everything later on.
Thanks again!