How can I use the internal clock of a NI-DAQ (USB 6211) data acquisition board?
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
Julien GATEAU
2023-3-2
Dear Adriana,
We have the same question here, did you get any answer?
Thanks,
Julien
回答(1 个)
Manikanta Aditya
2024-1-11
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simultaneous and Synchronized Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!