08-13-2013 03:23 AM
Hello,
I have a NI-6220 and I connect quadrature encoder to it . Then I use Measurement & Automation program to read the encoder and it works well.
the problem when I use the c++ program it doesn't work and demonistrate arandom fixed value.
in attached files the code which I used .
I'm waiting for your reply.
Best Regards,
Alaa Mohammed Abd Elmoaty Khalifa.
Solved! Go to Solution.
08-14-2013 04:39 PM
Hello,
Have you tried using a simple example code with your card? Oftentimes errors like these can be attributed to a small error in the code. If it works with the example code, you can compare the syntax of the example to your own. I am attaching an example that should work for your system.
-Erik S
08-15-2013 03:06 AM
Dear-Erik S,
thank you for your replay
I already used another examples and they worked well.
Also ,I tried to change every parameter in the program but it didn't work .
Can you help me and send to me another program to read encoder or advise me to change what parameter in the program.
THANKs
08-16-2013 01:44 PM
Are you getting any kind of error whenever it returns a fixed value? I looked through your code, and the syntax appears to be correct. An error could point us to which function call is causing the problem. I found a link to some more sample code regarding angular encoders. Here is the link:
-Erik S
08-20-2013 04:24 PM
Well I'm not sure how this isn't giving you a compiler error, but I'm seeing the name of the variable in your DAQmx Read call as "data1" instead of "data".
Best Regards,
08-26-2013 03:29 AM
Hello,
thanks to all for your interest ,I found the solution to this problem.
The code needs to display data[0] not data only because data contain 1000 place for each sample.
Thank you very much.
Best Regards,
Alaa Khalifa.
09-04-2013 04:59 AM
Hello every one,
the previous program is working well , but when I make a new project or a new program with the same code it doesn't work and display an error
1>.\WriteDigChan.cpp(211) : error C2664: 'DAQmxReadCounterF64' : cannot convert parameter 4 from 'float64 (*)[1000]' to 'float64 []'
I think the problem in the properties of the new project , although I review it with the old one .
I'm waiting for your reply.
Best Regards,
Alaa Khalifa.
09-05-2013 12:47 PM
Hi Alaa,
This could be a problem with attempting an implicit conversion that needs to be explicit. Here is a link to Microsoft page that explains how to resolve the error:
http://msdn.microsoft.com/en-us/library/s5b150wd.aspx
-Erik S
09-11-2013 04:20 PM
Dear all,
Why I get this error
Error -200141 occurred at DAQ Assistant "Data was overwritten before it could be read by the system. If Data Transfer Mechanism is Interrupts, try using DMA or USB Bulk. Otherwise, divide the input signal before taking the measurement."
note
I have 4 encoder with the same specifications and I make the same connections, 3 motors worked well but the fourth give this error .
09-12-2013 12:09 PM
That error typically indicates that the counter buffer is overflowing. You may be able to avoid the error by decreasing your sampling rates. Check out this discussion forum that appears to cover the same issue:
-Erik S