04-02-2020 06:41 AM
Dear all!
I have a rotator encoder connected to a NI USB 6001 and I try to reset it to initial count every time it makes a full round. So let's say in my code when the count reaches to '930' it should be reseted to '0' (=initial count). Can anybody provide me some help?
Your Sincerely,
SzSzilard
Solved! Go to Solution.
04-02-2020 06:47 AM - edited 04-02-2020 06:50 AM
Hi Sz,
use a quotient&remainder function…
On your image:
You read some data from a DAQAssistent, buried in a DDT signal wire.
Then you read an array of values from your counter DAQmx task and convert this nice 1D array into an ugly DDT signal wire.
Then you merge both signals into another DDT wire - just to display all those values in a scalar numeric indicator!?
Even though DDT wires allow such silly operations they most often doesn't make sense!
04-02-2020 12:32 PM
Thank you for your answer. I modified my code as you said, I added some really unusual things earlier. But I still don't get to reset the counter to initial value(0). Any suggestions?
04-02-2020 12:58 PM
Do not use the DAQ Assistant or Dynamic Data wires. At all. It's an unfortunate trap that NI put in, as they LOOK like they're a super simple way to program, but they're unfortunately way more trouble than they're worth.
Go to Help -> Find Examples -> Hardware Input and Output -> DAQmx -> Counter Input -> Counter- Read Encoder (there are a few of them).
You can input your rotary encoder's counts per revolution in the DAQmx Create Channel function. The example should run your encoder straight away with zero code modification and you'll have it.
For more reading, check out this article:
and you should be WELL on your way to making DAQmx work for you.
04-02-2020 01:16 PM
Thank you for your response and for your help! I will read Your suggestions!