Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

camera file serial interface

I have developed a camera file for a new camera that acquires the image data correctly.
 
I also have developed a program that can modify serial parameters using clallserial.dll  and it can collect data corretly using the NI frame grabber software. 
 
Now for my problem.  I would like to add these serial commands to the camera file.  However the data I need to send must be broken up.   (ie  the user enters 62, but I need to send 0x86 + 0x42).       The serical interface is something like   cmd (86)  rsp(01)  cmd(42) rsp(01) .        The only way I can figure out how to do this is to use 2 different fields & require the operator to understand the command syntax....and make sure he enters them in the correct order.  This isn't too bad for a 2 byte value, but I also have a 32 byte value (arggghhhh)       Never thought I would WISH we were using ascii, not hex.
 
 Any better suggestions?   (other than changing the interface  🙂 )
0 Kudos
Message 1 of 12
(5,414 Views)
Hi dkim -

What about the setup shown in the attached picture?  The commands are sent in succession when the attribute is selected, and the second command is only sent after the response for the first is received.
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 2 of 12
(5,402 Views)

Yes...  Exactly what I want...  except I want the operator to be able to enter 62 to make that to happen..    I don't know how to combine ( &  |  ) his response to make the associated 46 & 82 .    Probably more complexity than the tool will allow.      I'm sure hard-coding values would work great, but kinda defeat the purpose.

or enter  4562  =>  causing bytes  44 & 85 & 46 & 82  to be sent down (or something like that).   I won't be disappointed if the tool doesn't support it, just wish our interface would have been different.  Thought I'ld ask in case I missed some magic somewhere.

 

 

0 Kudos
Message 3 of 12
(5,400 Views)
I understand now.

Unfortunately, NI-IMAQ camera files aren't built to work that way.  The serial settings in a camera file are only used to set camera attributes during initialization and startup.

However, you can code the functionality you want into your program.  In LabVIEW, for instance, the IMAQ Serial Read and IMAQ Serial Write VIs can be used to communicate with your camera any way you want.  You could write a function that parses the user's input and performs the needed serial communication.  So your program would initialize the board to establish a session, then the user could do their serial I/O, then you could start a Grab or Snap operation using a camera file that doesn't change any camera settings.  (This would keep the driver from overwriting the user's input.)
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 4 of 12
(5,397 Views)
Yes, that's what I was expecting.  We'll do that  or just use our own interface to your frame-grabber.   Thanks for confirming what I already thought  (didn't want to create more code for the firmware guy than I had too).    I like the NI software & your quick answers to questions!  Thanks a lot.
0 Kudos
Message 5 of 12
(5,394 Views)

Sorry to jump in here, but is there a way to do the serial i/o through the CWIMAQ activeX control in VB?

 

Don

0 Kudos
Message 6 of 12
(5,217 Views)
Serial reads & writes can be accessed from VB using clSerialRead & clSerialWrite.  I access these functions via clallserial.dll.
 
 
0 Kudos
Message 7 of 12
(5,192 Views)
Could you elaborate? Maybe some sample code?
0 Kudos
Message 8 of 12
(5,190 Views)
The following document might help.   It at least explains the concept.
 
 
However, I found that the VB "prototypes"  specified in the above document didn't seem to match the clallserial.DLL I had access to.  There were some "by ref" and "by val" inconsistancies.   It might be dependent upon which company is supplying the DLL (although VB was foreign to me at the time...I'm more int c & c++). 
 
The code is quite simple.   Just  add the prototype (or whatever it is called in VB)  and make the call.    The specific serial commands are completely dependent upon the camera though (or whatever interface is receiving the serial camera link data) .    I seem to remember a warning from one of the documents I researched this subject on.   YOU MIGHT BREAK YOUR CAMERA BY WRITING TO INVALID REGISTERS.....so,  I suggest you learn to READ 1st....then write.
 
I cannot supply the code snippit because I don't own it 😞    Sorry.
 
0 Kudos
Message 9 of 12
(5,184 Views)

Thanks for the info. I was confused and thought that the cl* stuff was from NI.

 

0 Kudos
Message 10 of 12
(5,182 Views)