How can I use the internal clock of a NI-DAQ (USB 6211) data acquisition board?
11 views (last 30 days)
Show older comments
Hello,
I am trying to connect a Single Photon Counting Module that gives a TTL signal to a NI-DAQ model USB 6211 and I would like to use the internal base clock with MATLAB. In the manual of the NI-DAQ says it has of 80 MHz, 20 MHz, 0.1 MHz, so I am sure for this model it has an internal clock. My question is if there is a code to use this internal clock.
Thank you,
Kind regards.
1 Comment
Julien GATEAU
on 2 Mar 2023
Dear Adriana,
We have the same question here, did you get any answer?
Thanks,
Julien
Answers (1)
Manikanta Aditya
on 11 Jan 2024
Hi Adriana,
I think you are trying to connect a Single Photon Counting Module that gives a TTL signal to a NI-DAQ model USB 6211 and you would like to use the internal base clock with MATLAB. You are not sure whether NI-DAQ has a internal clock and wants to know if there is a code to check the same.
Here is a possible workaround example of how you can do it:
% Create a data acquisition session
s = daq.createSession('ni');
% Add a Counter Input Channel
% You need to replace 'Dev1' with the actual ID of your device
% 'ctr0' is typically the ID for the first counter channel
% 'EdgeCount' is to count the rising or falling edges of a TTL signal
ch = addCounterInputChannel(s, 'Dev1', 'ctr0', 'EdgeCount');
% Set the input terminal for the clock
% This will use the device's internal clock
s.Channels(1).Terminal = 'PFI0'; % or another PFI terminal if required
% Configure the clock
s.Rate = 1000000; % Set the clock rate to 1 MHz (adjust as needed up to 20 MHz for USB 6211)
s.DurationInSeconds = 1; % Set how long the counter will run
% Start the session
[data, time] = s.startForeground();
% Calculate the frequency
frequency = data(end) / time(end);
Here, in the example you can check the ‘Rate’ property sets the frequency of the internal clock. You can adjust this to one of the frequencies supported by your device. The ‘startForeground’ function then starts the acquisition, which will run for the duration specified by ‘DurationInSeconds’
Please refer to the following references to know more about:
- ‘daq.createSession’: https://www.mathworks.com/help/daq/ref/daq.createsession.html
- 'startForeGround' : https://www.mathworks.com/help/daq/ref/startforeground.html
Hope it helps.
0 Comments
See Also
Categories
Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!