Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading serial port on PCI-1422

MG,

 

I have the same camera and pci board....and am trying to control the integration time as well.  However, I am lost in how to do this..(even after reading the posts above).  Did you ever get a vi that worked?  Would you mind sharing with me so that I can figure out how to do it?  Any assistance would be helpful.. I tried to write a read program and kept getting a timing out issue.

 

Regards,

 

Cali

0 Kudos
Message 11 of 27
(2,460 Views)

also, is the byte count always the same?  another thing is how to figure out what to put in the status count packet info.. how did you know FFOO was unread by slave?

 

thanks

0 Kudos
Message 12 of 27
(2,432 Views)

The Byte count will depend on the number of data bytes you are sending.  This tells the slave device how many byes of data it should expect to read.

 

For my case, the Status packet doesn't matter when sending data, but will sometimes contain useful info when reading the reply.

0 Kudos
Message 13 of 27
(2,425 Views)
Here's what I found in the old VI archives.  Not sure if this version works, but I really don't have time right now to go check it.  That being said, I think there are some subVIs that might be of use to you.  Send Camera CMD and Get response has "the good stuff".  It shows how to do the checksum.  Hope this helps.  Again, keep in mind this is for a specific version of the firmware (very early on), and we had asked Indigo to modify the firmware to give us the ability to trigger the camera externally, so this code may not work with other cameras.
0 Kudos
Message 14 of 27
(2,409 Views)

Hi MG,

 

Thanks for the VI files.  I tried to modify the Camera CMD and Get response VI and I got an errror due to the termination character issue with the alpha nir camera (because of serial read vi).  I attempted to modify the vi and replace it with the serial byte vi and now I get a timing error..  I saw in the earlier posts that you were having the same issue with the serial read and the camera... did you ever get a vi to work using the serial byte vi..do you have it?  I know you are busy so thanks for taking the time to help.

 

Thanks again,

 

Cali

0 Kudos
Message 15 of 27
(2,378 Views)

here's the VI I'm doing the reads with.

It's not runnable on my current machine b/c I don't have IMAQ loaded but I think it will work for you.  Not sure if this is the same version as previously uploaded or not.

 

 

Message 16 of 27
(2,369 Views)

MG,

 

okay, so I'm sending the following commands through imgSessionSerialWrite:

 

49/03/00/00/00/00/01/00/00/4D       -> LONG_INT

49/81/01/00/00/00/02/00/00/00/CD  -> READ_FPA

 

I manipulate the four least significant data bits to fit what I want to send back

 

49/01/01/00/00/00/02/**/**/??/??     -> WRITE_FPA   * and ? depend on the read response

49/03/03/00/00/00/02/xx/xx/??/??  -> INT_TIMER      x and ? depend on the desired time

 

 

After each use of imgSessionSerialWrite(sid, buffer, &size, 3000);  I follow it with

 

imgSessionSerialRead(sid, buffer, &size, 3000);   which returns nothing but 0's

 

 

any clue what I'm missing?  Why am I not getting a buffer that looks something like:

 

49/03/00/xx/xx/...  after the imgSessionSerialRead() function?

0 Kudos
Message 17 of 27
(2,032 Views)

Not sure.  This looks like "C" or "C++" function calls to me. 

 

All my work was in "G", and I don't have the prototypes of your function calls, or the manual describing what the parameters do.

 

You might want to implement a loop that reads a single byte at a time (while bytes are pending).  Normally, that ends up being the answer when I'm dealing with a serial device.

 

Sorry I can't be of more help.

0 Kudos
Message 18 of 27
(2,031 Views)

 


vs3@tamu wrote:

MG,

 

okay, so I'm sending the following commands through imgSessionSerialWrite:

 

49/03/00/00/00/00/01/00/00/4D       -> LONG_INT

49/81/01/00/00/00/02/00/00/00/CD  -> READ_FPA

 

I manipulate the four least significant data bits to fit what I want to send back

 

49/01/01/00/00/00/02/**/**/??/??     -> WRITE_FPA   * and ? depend on the read response

49/03/03/00/00/00/02/xx/xx/??/??  -> INT_TIMER      x and ? depend on the desired time

 

 

After each use of imgSessionSerialWrite(sid, buffer, &size, 3000);  I follow it with

 

imgSessionSerialRead(sid, buffer, &size, 3000);   which returns nothing but 0's

 

 

any clue what I'm missing?  Why am I not getting a buffer that looks something like:

 

49/03/00/xx/xx/...  after the imgSessionSerialRead() function?


 

Are you resetting your size parameter in between the two calls? The variable is used for input as the size of the array and on output to tell how many bytes were read/written.

 

Eric

0 Kudos
Message 19 of 27
(2,029 Views)

okay, so the third parameter is an output parameter?  I have been using it to tell the functions how many bytes to write/read...  it sounds like that is incorrect.

 

on a slight tangent, I just placed the imgSessionSerialFlush() function in before my write function, and put a imgSessionSerialReadBytes() command in between the write and read functions.  The imgSessionSerialReadBytes() function populates the buffer with the response I expected from the imgSessionSerialRead() function...

 

What is the difference between these two?

0 Kudos
Message 20 of 27
(2,026 Views)