Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Write and read data from PCI-6601

Hello everyone,

I am generating a count by using an encoder connected to a PCI-6601
 
A laser sensor is being used to trigger the PCI-6601, where I have a Labview compiled exe program that read the counter and write it to the hard drive.  Simultaneously when triggering the PCI-6601, I am also triggering a camera running under Vision Builder AI, where I have a Vi that read the counter data from the hard drive.
My problem is that it looks that the Vi from Vision builder reads the data before, or at the same time as the exe program write to it.  How can I interface the two programs so I assure that the write is done before the read.

Thank you in advance for any help.

Gert
0 Kudos
Message 1 of 6
(4,337 Views)

Gert,

    There are two possible solutions that I can think of immediately.  The first would be to do the acquisition in LabVIEW in a Run LabVIEW step in VBAI.  That way you can run the step to acquire on the trigger, then program control will not return to VBAI until the file has been written to.  Another method, which is simpler though may not be as accurate, is to put a Delay into your VBAI code (it's in the last menu, the Additional Tools menu).  If you have it delay for a few milliseconds after the trigger, LabVIEW should have time to write to file.  Let me know if either works for you, or if you have more questions.  Thank you!

-Allison S.

Applications Engineering 

-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 2 of 6
(4,315 Views)

Allison,

Thanks for your reply,

I do not like the second option since I would have to play with the delay.  The first option sounds better.  If I understand you correct, I would make a Vi called from VBAI that would request the encoder exe program to write to the file, and then another Vi to read the file?  I understand that the first Vi has to finish before the second can execute, but how does the first Vi communicate with the encoder exe program?

gert

 

0 Kudos
Message 3 of 6
(4,310 Views)

Gert,

    You would only need to call one VI from your VBAI inspection.  It could have, for instance, a sequence structure with two blocks.  In the first block you can open, write, and close the file, in the second you can open and read the file.  That sounds a bit redundant though, if you want a value that needs to be read from LabVIEW, you can simply call a VI from VBAI that reads the value, writes it to your file, then returns the value to VBAI.  Am I assuming correctly that you need the value in VBAI?  If you describe a little bit why you are writing to file, and how you want the data transfer to move (data acquisition to LabVIEW to VBAI?) it may be easier for me to help you with design ideas.  Thank you!

-Allison S.

Applications Engineering

-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 4 of 6
(4,295 Views)

Allison,

The image I am taken by VBAI moves pass the camera every 6-800ms. I am taken the image on the fly, and I also have to measure the distance between each part (image).  I am triggering the camera and the encoder program off the part.  The same trigger signal goes to the camera and to the encoder exe program.  While VBAI massage the data (it takes between 40 and 100ms, I think), the encoder program store the encoder value on the hard drive.  VBAI now read the encoder value from the hard drive, and store image data and encoder data as a common file to the hard drive for the QC department.  VBAI also stops the process if any measurement are out of limit.  My initially problem was that I missed some measurements because of the VBAI program was too slow.  I optimized that, but now it seems that I am missing encoder readings.  That why I would like to avoid to include a delay in VBAI.

gert

 

 

 

0 Kudos
Message 5 of 6
(4,289 Views)

Gert,

    So your images are coming in at 600-800ms, and there is an encoder involved.  You said that the camera and the program are triggered - which program is triggered (VBAI or LabVIEW)?  Are they triggered off of an encoder?  Is this encoder related to a motor moving these parts?  Once the program is triggered, LabVIEW saves the encoder value, I believe, then VBAI after processing reads the encoder value from file and writes the value and the image data to file.

    If any of that is incorrect, let me know.  From what I can tell, you may be operating as quickly as possible.  It is possible that VBAI is not capable of completing the analysis in your inspection quickly enough to keep up with the encoder.  Try, just for testing, removing a step or two from your VBAI analysis and see if that corrects the problem.  You may be able to streamline it a little more though -- for instance if you call a LabVIEW step from VBAI that reads this encoder value, and instead of writing it to file, just send to value to VBAI.  Then VBAI wouldn't have to read from file, but the LabVIEW step would not be able to run simultaneously.  Let me know what you think, and if you have anymore questions.  Thank you!

-Allison S.

Applications Engineering

-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 6 of 6
(4,260 Views)