From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use the matlab toolbox and define the edge count term and sample clock timing PFI inputs

We are using Matlab for controlling a DAQ 635.

We are suffering from extreme memory leaks, and we therefore want to switch to the newer toolbox based control.

However, we are having problem migrating our code... specifically, we are trying to define an edge count measurement, and we need to define both the sample clock input to one of the PFI lines and also the edge count term to another PFI line.

Previously, this was as simple as writing the following three commands:

 

DAQmxCreateCICountEdgesChan(task, 'dev1', '', edgeRising, 0, countDirection);

DAQmxCfgSampClkTiming(task, '/dev1/PFI5', sampleRate, edgeFalling, sampleMode, nCounts);

DAQmxSetCICountEdgesTerm(task, '/dev1/Ctr0', '/dev1/PFI1'  );

 

However, in the toolbox, it seems that we can only ask what the terminal is - using the .Terminal property of the channel (Which I believe it is the count edge term) but we were not able to change it... And I couldn't find how to change the sample clock at all.

 

Any help would be appreciated.

0 Kudos
Message 1 of 4
(2,120 Views)

Hey Yomach,

Sorry to hear about these troubles you are having. A couple questions for you:

1. What is the specific DAQ Device you are using? They normally have 4 numbers in the name.

2. Where are you migrating from/ to where are you migrating your code to?

 

Thanks! 

Joseph

0 Kudos
Message 2 of 4
(2,088 Views)

This may not be the main problem, but there appears to be a subtle little syntax issue.

 

The leading '/' character is needed when referencing terminals as in '/dev1/PFI1'

However, it shouldn't be present when referencing channels as in 'dev1/Ctr0'

 

I've never heard an explanation for why it's supposed to be a good idea to have that particular distinction.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 4
(2,079 Views)

Hey Joseph,

1. Sorry, I missed a digit, it's 6351.

2. We're migrating from matlab (directly accessing the functions) to using matlab with the toolbox wrappers.

 

Kevin - 

Thanks for the note, but this is just a misprint of me while copying the code.

In our code, these are represented by variables, so when I typed them into the forum, I inserted the syntax problem...

 

As a side note - we found out that our memory leak was unrelated... However the main question still hangs, is it possible to change the terminal for a counter measurement using the toolbox?

0 Kudos
Message 4 of 4
(2,076 Views)