Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

wrong serial terminator in Basler A504k icd

Solved!
Go to solution

I'm trying to talk serially from LV to an Basler A504k via a NI-1429e, and, despite what said in the compatibility report and in this post, I perfectly succeed, at least as far as I've tried. An (yet unpolished) example of my command VI is attached (LV8.6.1), for the sake of anyone running in my same problems.

 

However, there is one thing which bothers me about the string terminator defined in the camera file. The original definition is

 

TermChars (\x06)

 

That is not correct.  \x06 is the ACK character sent by the camera to acknowledge that the command sent by the host was correctly formed; normally strings are terminated by ETX, i.e. \x03, whereas the camera can answer with a single NAK, i.e. \x15, if the query string was malformed. For this camera, the command sequence for a Read is (when correct) STX-query-ETX->ACK-STX-answer-ETX, so if ACK is used as the terminator, the answer to Read commands is always lost. At least, as long as "IMAQ Serial Read.vi" is used; since the command format of the camera is strict, an alternative using "IMAQ Serial Read Bytes.vi" and the exact number of characters to be read would be always possible.

 

It was straightforward to change the TermChars entry to (\x03) in the camera file, and with that my VI essentially works, while the readback wouldn't with the wrong terminator.  The only quirk I'm aware so far is that I seem to be able to set the parameters Timer1 and Timer2, which control the exposure time and frame rate, but not to read them back, contrary to what the manual says (the camera always answers 0).

 

Any comments on this?

 

Enrico

0 Kudos
Message 1 of 9
(5,179 Views)
Solution
Accepted by topic author Enrico_Segre

Correction to what I just wrote above - reading fixed numbers of bytes is anyway mandatory, as the binary camera reply may contain \x03 or whatever in the data field. That was actually the reason I couldn't read back some particular fields, like the firmware versions or the Timer data.

A corrected version of my previous vi is attached. As for me, the issue is now solved - this message for the sake of other in my situation.

0 Kudos
Message 2 of 9
(5,171 Views)
Thanks for posting, Enrico!
Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 3 of 9
(5,150 Views)

And since we're at it, here is the polished, drop-in version of the VI.

Enrico

 

0 Kudos
Message 4 of 9
(5,148 Views)

Hi Enrico,

 

This is a great piece of example code, would you mind posting it to the Example Code section of the Developer Zone: http://zone.ni.com/dzhp/app/main

 

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 5 of 9
(5,132 Views)

Hi Enrico,

 

This is a great piece of example code, would you mind posting it to the Example Code section of the Developer Zone: http://zone.ni.com/dzhp/app/main

 

Thanks!

 

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 6 of 9
(5,131 Views)

Well, if you say so... I've put it here.

Thanks for the appreciation, Enrico

0 Kudos
Message 7 of 9
(5,111 Views)

Dear Enrico,

 

you uploaded your sample code as a VI for LabVIEW version 8.6. I would definitely like to take a look at your program. However, I only have version 8.2.1 installed and cannot open it.

 

Would you mind saving the VI for a previous version (compatible with LabVIEW 8.2) and upload it here again?

 

Many thanks in advance,

Benjamin

0 Kudos
Message 8 of 9
(5,069 Views)

I save it for 8.0 and upload in the community page. Hope you find it useful.

Enrico

Message 9 of 9
(5,064 Views)