Effacer les filtres
Effacer les filtres

NI Instruments USB 6221 - Edge Counter

3 vues (au cours des 30 derniers jours)
Christos
Christos le 14 Juin 2012
Hi!
i can get the edge counter value when start the motor manually. but when i tried to start the motor using a MATLAB programme, the edge counter value is always zero.
i try to use startForeground function and get the following error
The startForeground/startBackground methods are clocked operations. To use the session object in clocked mode with the counter input edge count channel 'ctr0', an external clock must be supplied. If the USB-6221 has an analog subsystem, add any analog input/output channel belonging this device (Dev1) to allow the session object to automatically configure itself to internally share this device's source clock.
i write the following matlab function: function counterValue = getCounterValue(ny)
daq.getVendors();%get vendor device details s = daq.createSession('ni');%create session using daq commant
s.addCounterInputChannel('Dev1', 'ctr0', 'EdgeCount'); %create channel fro inpurting the counter value s.resetCounters;%clear the counter channel s.Channels(1);%get information about the open channel data = s.startForeground; data counter = 1; while(counter < ny) counter = counter + 1; end counterValue = s.inputSingleScan; %store the counter value in return variable s.resetCounters; delete(s);%delete session
i hope there is someone that can help me about this.
Thanks a lot
Christos

Réponses (0)

Catégories

En savoir plus sur Data Acquisition Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by