12-01-2011 07:34 AM
Hi
I am currently using VBAI 2010 with my smart camera and for exchange of variables I use the CNVCreateWriter function to communicate with CVI 2010. It is working fine when I am in the configuration interface. I can use and modify all variables without any problems.
But when I switch over to the inspection interface I can not modify the variables any more. By using the CNVCreateWriter function I get the error message: NON-FATAL RUN-TIME ERROR: "Camera_Api.c", line 130, col 14, thread id 0x0000107C: Function CNVCreateWriter: (return value == -6345 [0xffffe737]). Could not complete operation in specified time
Does anyone know why it is working in the configuration interface but not in the inspection interface under real conditions?
by the way: I can not use VBAI 2011 at the moment because we have not yet a licence for it
thanks in advance
Oliver
Solved! Go to Solution.
12-01-2011 08:21 AM
In configuration mode, things run slower on the smart camera because we synchronize execution with updating info on Windows about step status/state executing, etc. When you run in inspection mode, it runs as fast as possible, so there may not be as much available processor time to handle the variable access requests from your C application. Is your inspection acquiring triggered images, or going as fast as the smart camera can possibly go (i.e. non triggered in immediate mode)? If you are in free run mode, what happens if you change to wait for next...this may give the processor a little more time to update variable requests while it's waiting for the image to be acquired. Another way to test this theory would be to put a delay step in your inspection and see if that works (start with 100ms and if it works, see how small you can make it).
Something that might also help is to define the variables on your host machine, and in VBAI create a network variable that binds to the variables defined on your PC. This way, the shared variable engine on RT doesn't have to handle updates from your PC as well as updates from VBAI, as well as running the inspection as fast as possible, and your C application shouldn't have any trouble accessing variables on the same machine. It does mean that your PC needs to be up and running when your inspection runs on the smart camera or else there will be timeout errors accessing the variables...but this may be alright for your application. Here is a nice document that talks in depth about shared variables.
http://zone.ni.com/devzone/cda/tut/p/id/4679
Another option might be to use TCP, serial, Ethernet/IP, or some other protocol to read/write variables in VBAI.
Hope this helps,
Brad
12-02-2011 02:24 AM
Hi Brad,
you are right, it was the speed of the camera. We made a test in the inspection mode and integrated a delay of 100ms and the communication worked. The we reduced to 50ms and it didn't work anymore. So, you were right that it could be the speed of the camera.
I am not sure if we can run the camera triggered for our application, in the moment we run it free, that means, as fast as possible. We will check now alternatives.
Also we will check your second tip with the shared variables on the computer. I will keep you updated about the results
Thanks
Oliver
02-02-2012 02:43 PM
Hi,
meanwhile I found something interesting out.
We did the first tests with continous aquiring of images. There we had to include a delay of more than 75ms to realize a communication.
Meanwhile we use triggered mode, and there is no more need of delays to have a good communication.
greetings
Oliver