01-10-2008 09:02 AM
01-10-2008 10:50 AM
01-14-2008 02:06 AM
Hey Jochen,
Your code is quite confusing and there are many things which could be changed, but maybe the following part is the error producing:
You will notice that you wired the error not from the DAQmx Start VI to the Read and the Stop, so it can happen that you stop the Task while or before reading! Just wire the error from the DAQmx Read.vi to the Stop.vi, maybe this solves the error.
Christian
01-15-2008 01:10 AM
01-15-2008 06:17 AM
Hey Jochen,
Maybe exactly this error wire is the problem, but for another reason. If you would wire it trough the Start>Read>Stop I think you would get another error than the -200278, maybe a timeout error. You have configured a timeout of 2ms for the DAQmx Read.vi which could then run in the timeout if no rising analog edge trigger occurs within this time.
Another thing could be, as you allready mentioned, that the Analog Comparison Event blocks another Start-Trigger because you allready configured one (ai1, ai2), and to don't get two differnt triggers it's not possible to set another Start-Trigger, but I'm not sure about this assumption. Out of DAQmx help:
| AnalogComparisonEvent |
A terminal within a device where the output of the analog comparison circuit, the Analog Comparison Event signal, can be found. This circuit is active whenever an analog edge or window trigger is configured. |
Are you running a hyperthreading machine?
Some hints: Build SubVIs out of your code (see attached .jpg as example), comment your computations, better wireing, switch to a state machine architecture, if you dont connect error wires to avoid or ignor specific errors just wire the error through instead and erase the mentioned error, ...
Christian
01-16-2008 04:11 AM
My best bet at the moment is a problem with the analog trigger. Sometimes, right after switching from analog to counters, I get some false values from the counters at the beginning of the first measurement. The following measurements are all working. I know the encoder is working perfectly, so the analog trigger might not have switched fast enough. But on the other hand: the counter measurement is continiously switching the analog trigger from ai1 to ai2 and back. Shouldn't I get false values in this case aswell?
Yes, I am using an Intel Pentium4 with HT, no dual core.
Your coding style hints are of course very important. Particularly a good commentation is importand if I want to ask someone for help. I promise I will clean up my code if I upload a VI next time 😉
Please understand, that the test.vi is only for testing and demonstration purposes. I intentionally didn't use any subVIs so I could upload it more easily. It is also very comfortable if you can see every computation in the same blockdiagram if you are searching for bugs.
Best regards,
Jochen
01-16-2008 09:00 AM
Hey,
Did you also try increasing the timeout of the DAQmx Read.vi, e.g. 10ms?
Christian
P.s.: The only reason why I wanted you to change the error wireing was that it could be possilbe that the DAQmx Stop.vi produces another error than the DAQmx Read.vi, which then were lost because the merge error function only routes the first error through out. So to be sure to get the first error in your case this change made sense.
01-17-2008 01:46 AM
Good morning Christian.
No I didn't, because I do get timeout errors if I configure the wrong level for the analog trigger, or if the rotation speed is too low. Nb: the timeouts unit is seconds not ms.
Also the timeout theory wouldn't explain, why I have to reset the device.
I guess I'll have to use an analog measurement and find my edges using software, although thats alot slower and consumes a lot of memory.
01-17-2008 02:43 AM
Hey,
Sure, the timeout is in seconds, sorry thats the force of habit! Another hint would be to turn of hyperthreading, could you test this please.
Christian
01-17-2008 03:54 AM
OK, I just gave it a try and I wasn't able to reproduce the error within at least 20 minutes. I'll have to try again the next days to make sure it's working reliably.
Did you just make a wild guess, or is HT known to cause problems with NI hard- and software?
Greetings,
Jochen