Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send Photonics serial commands?

Solved!
Go to solution

Hi!

 I have to send control commands to the IR light source evaluation kit of ICx Photonics via Labview 9.0. So I tried the example VI 'Basic Serial Write and Read.vi'. To send a command I've to write a capital letter then its value and finally a carriage return. For example P102[cr]. Because of the carriage return I set the termination char to '13' (dezimal) or 'D' (hexadezimal). Now Labview and the evaluation kit know when a command ends. The problem is, that I only get back strange letters and '?' as answers. What means one part either Labview or the evalution kit doesn't understand the commands. Since all other settings are right I guess that Labview doesn't send with the emulation ANSI? 

 

But when the problem is ANSI then I don't understand why I get the right answer when I send a single 'I' for  the firmware version. Is it possible, that only the first letter is interpreted right?

 

Is there another termination char that I may try? Til now I've tried [cr], [CR], [lf], [LF], \r, \n, combinations of them, none of them,...

 

The hardware is ok. I could get the desired results with the HyperTerminal.

0 Kudos
Message 1 of 11
(5,834 Views)

Are you putting the termination character in the string control after your command? Setting the term character for the VISA Configure Serial Port does not set the termination character for the write. In the string control of the example you mention, you have to use '\' codes. If \r or \n does not work, try both.

 

p.s. You mean ASCII instead of ANSI.

0 Kudos
Message 2 of 11
(5,827 Views)

You mean I've to put a '[cr]' after each command and after the whole string a '\r' or '\n'? Well I didn't try it that way, I'll do it on Monday.

But I do mean the emulation ANSI. In the HyperTerminal you can set the emulation and my instructions say, that I have to set the emulation to ANSI. So I thought that I have to set it in Labview, too?

0 Kudos
Message 3 of 11
(5,818 Views)

A [cr] is not correct. It represents a carriage return character in your manual probably and you do not use that text. You have to use \r for carriage return. The string control is set for '\' Codes Display and that is why the default text has '*IDN?\r\n'. The \r and \r are a carriage return/line feed.

 

Okay, I understand the ANSI reference now. That just means a type of terminal emulation. The simplest kind with no special control codes, display features, etc. There is no setting for terminal emulation in LabVIEW because it is not a terminal emulation program. It's a programming language and if you needed to emulate a different type of terminal, you would have to write a program to do that. You don't have to worry about that in this case.

Message 4 of 11
(5,807 Views)
Well, '\r\n' or similar combinations don't work. As you see in my screenshot it stops interpreting after the first command and it doesn't understand that one (nor the others). The device should give back the same commands as answer.When it doesn't understand a command it sends it back with a '?'.
Message Edited by Helga on 11-30-2009 05:29 AM
0 Kudos
Message 5 of 11
(5,763 Views)

Try sending only one command at a time.

 

Do you have an electronic copy of the manual that you could attach?

0 Kudos
Message 6 of 11
(5,744 Views)

It doesn't work with only one command, too.

 

Here is the manual: Evaluation Kit

Look at page 9 of the pdf - there're the relevant instructions.

0 Kudos
Message 7 of 11
(5,738 Views)

According to the manual, you should only be sending a carriage return. Have you tried that? You also have to send one command at a time.

0 Kudos
Message 8 of 11
(5,734 Views)
 Yes, I've tried that, too.
0 Kudos
Message 9 of 11
(5,727 Views)
Solution
Accepted by topic author Helga

I'm running out of ideas. Hyperterminal allows you to set a delay between characters. Maybe that's what you need? The code to do that is shown below.

 

Message Edited by Dennis Knutson on 11-30-2009 11:27 AM
Message 10 of 11
(5,718 Views)