09-11-2008 08:00 PM
Hello.
I'm using PCI6229 to measure ang position with a quadrature encoder, everething runs fine in LV, but I need this application to run in some text based languaje, so I ran the extample from Measurement Studio located here:
C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Measure Position\Angular Position-Buff-Cont
But it only gets to this line:
printf("Continuously reading. Press Ctrl+C to interrupt\n");
and nothing else appears on the DOS prompt. It is supposed to go over this line but this is all i get
I'm using VC++ 2005 express edition on a wvista computer to run this example (I could've used the specific example for this program but VC++ asks me for the windows.h file, which i don't have so I decided to run this ANSI C example.)
Any suggestion? any help will be apreciated.
09-30-2008 11:15 AM
09-30-2008 09:17 PM
I apreciate your concern
Thanks for your answer
I already tried to use the next version of daqmx and a vista compatible version of vc++ but still not working, i'll try some other things that i haven't tried and then definetly give up.
09-30-2008 09:24 PM
Sorry about that, ricarmen answer is actually ZainZeus answer, who is me.
It's just that ricarmen and I use the same computer in campus and she didn't logged off from her user and i didn't realize about that
but again the answer above this one is ZainZeus posted,
Apologies
ZZ
10-01-2008 11:41 AM
10-01-2008 12:02 PM
How long will does it pause at DAQmxReadCounterF64(taskHandle,1000,10.0,data,1000,&read,0). Have you waited longer than 10 seconds before aborting the program? If you wait 10 seconds I would expect you to get a time out error saying that the board has not acquired all the samples that you asked for before the timeout period elapsed. For the DAQmxReadCounter to return before the 10 second timeout you must supply a clock to PFI 8 and have it wired correctly. The clock must be running fast enough that the board will get 1000 clock ticks (the number of samples requested) before the 10 second timeout has elapsed.
Regards,
Neil S.
Multifunction DAQ
Product Support Engineer
National Instruments
10-01-2008 05:13 PM
You were rigth arturo, i had to wait 10 sec, if I move the encoder before 10 seconds i get "Acquired 444936 data", several times if i move it too much, if i don't move it i get:
Daqmx error: Measurements: Some or all of the examples requested have not been aquired,
Where do I see the data acquired?
This happened after i installed Daqmx 8.7.1 but with 8.5.2 it just showed press ctrl+c to interrupt,
Furthermore probably the problem is that i don't really understand this command. could somebody explainme a little about it?
In the other hand when I installed Daqmx 8.7..1 (which comes from the ni ftp server, meaning: I downloaded it ) the installation erased the examples I was using and only left the ones which had a debug folder on it, but it has not the code and only left the .exe file that vc++ created, can somebody send me those? They are the ones that says: ANSI C Examples.
Thank you people, keep helping me please.
10-03-2008 09:48 AM
I think the examples were just moved. The examples are now placed at C:\Documents and Settings\All Users\Shared Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C.
When your run this example data is read into the "data" variable. If you want to see the data you will need to print it out in some way. An easy way to do this would be to do something like:
int i;
for (i = 0; i < read; i++) {
printf( "%f, ",data[i]);
}
The way this example works is it programs the counter to measure the position of an angular encoder. The encoder position is then moved into a buffer every time the board sees a pulse on PFI 8. You can think of this as sampling the position of the encoder using PFI 8 as the sample clock. I hope this clears it up a bit, although I think it might be more helpful if you let us know what you are wanting to do and there may be a more suitable example.
Regards,
Neil S.
10-06-2008 08:09 PM
Hi Neil.
Sorry I confused you with arturo in the last post.
So you mean this example is not like in LV, where you just put daqmx assistant inside a while loop and see encoder's position every time as you move it? What use could it have having it read in a buffer and being able to "see" encoder's position only every certain time?
I don't see how for loop you posted work, because it only puts position every certain changes in encoder's angle. By the whay, Do i need to put :"DAQmxErrChk (DAQmxReadCounterF64(taskHandle,xxx,xxx,data,xxx,&read,0));"
at every reading? I mean does it has to be inside while loop?
You may not understand what I just said, so to put this simple: I just want -like in LV- beeing able to see encoders position as it changes, and it should has no time limmit, like in the example when it says: "Some or all of the examples have not yet been acquired" well i don't want that to appear, I want the reading to be time undefined.
ZZ
10-08-2008 09:03 AM
ZZ,
You can change the timeout to -1 and the DAQmxRead will continue indefinitely until all the samples you requested are acquired. However, since you are acquiring 1000 samples it may take a while for the read to complete, during which time your program will just sit there and do nothing. If you would like a more responsive program you could either use the EveryNSamples event architecture like the AI ContAcq-IntClk.c example, or you could poll the Available Samples property to find out when a sample or samples are available for reading.
Regards,
Neil S.