Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

timeout on serial communication with LS 321 temperature Controller

Hi,
 
I'm trying to communicate with a LakeShore 321 Autotuning temperature controller. Sometimes, my program does not go to the setpoint temperature that I want it to go to, instead it turns on the heater with the current setpoint. Also, I highlighted my execution while my program was running and apparently there's an error (-1073807339) that propagates through the program. However, when I highlighted my program before I ran it, no error occurred. Do you know how I can correct this error?
 
The baud rate is set to 1200 and I'm using a serial port to communicate to the instrument. I've also attached my vi.
 
Thanks,
Sammy
0 Kudos
Message 1 of 18
(6,041 Views)
Oh yes,
 
I've already successfully communicated with the instrument through Hyperterminal. I've matched the baud rates and already wrote a basic program that successfully sends commands and reads the replies.
 
Hope this helps. Thanks for the help!
 
- Sammy
0 Kudos
Message 2 of 18
(6,036 Views)

Hi,

I also forgot to mention that I'm running LabView 7.0 on Windows XP.

Thanks,

Sammy

0 Kudos
Message 3 of 18
(6,028 Views)

Hi Sammy,

The error number is: 'VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.'

After you send a command you are waiting for the number of bytes from the COM port. The time-out is specified at the start. So if your device need more time then the time-out you will get this error. Also in this way if your device gives a shorter answer then you would expect you will get a time-out.

I think it's better to use the function 'bytes at serial port' in a while-loop. In this loop you wait for a period (few seconds) or the expected number of bytes.

 

The string you send '0DH' was this ment as three characters Smiley Surprised ? It looks like a CR

In the third frame the error cluster stops at the second sequence.

 

Hope this helps.

 

 

Message 4 of 18
(6,025 Views)
Hi KC,
 
The 0DH is the CR. The LS 321 user manual says to include a terminator after every query or command (as one string). The format for the message strings is:
 
For Command: <command mnemonic><space><parameter data><terminators>
For Query: <query mnemonic><?><space><parameter data><terminators>
 
For the commands, if I have a terminator at the end, it doesn't seem to work or control the instrument correctly. I later found out that I could just leave out the terminator at the end (or place a space in between the parameter data and terminator), although the manual says to include terminators at the end of every string.
 
By the way, where is the "bytes at serial port" function that you mentioned? I can't seem to locate it.
 
Also, if the error stops at the second sequence, should I still try to fix it? One more thing (sorry for the list of questions), how do I find out how long or short the answer from my instrument is? How do I find out how many data bits are being sent out from the instrument to the computer? The settings are:
 
Baud rate: 1200
Character Bits: 1 Start, 7 data, 1 Parity, 1 Stop
Parity: Odd
Timing Format: Asynchronous
Transmission Mode: Half Duplex
Command Rate: 20 commands per second maximum
 
Thank you so much for the help. I really appreciate it and I hope you don't mind my long post.
 
- Sammy
0 Kudos
Message 5 of 18
(6,020 Views)

Hi Sammy,

I think it is better if you start with a VI that send one command to your device and get this working. If we make this VI useable for all command you can put it every where in your program.

The '0DH' you send are three asci characters. When you want to send a <CR> (carriage return) you must change you string constant (right mouse menu) to '\' or HEX display. In '\' mode you can fill in a '\r' in HEX mode you can fill in '0D'

'bytes at serial port' function is located in the serial pallete.

The answers from your instruments should be in the manual you (should) have.

I will try to send a example VI latter today.

and don't worry about length of your post or the number of questions. There are many LV....Smiley Tongue   here who are glad to be of help.

0 Kudos
Message 6 of 18
(6,019 Views)

Hi,

With this VI you can send a command to the COM port. It wait for the numbers of bytes you specify at the input with the maximum time specified in time-out.

Default it adds a <cr> to the command and the time-out value is 1 second.

Place this VI in a VI where you configure the COM port to your settings and add controls to the inputs of my VI.

Let me know if this works and if you can use this in your program

Message 7 of 18
(6,015 Views)

Hi KC,

I can't view your vi because I have LabView 7.0, and I don't have LabView 7.1 or a later version. Could you possibly send me the 7.0 version of your vi?

Thanks,

Sammy

P.S. I'll also get cracking on the basic program.

0 Kudos
Message 8 of 18
(6,002 Views)

Sorry, you mentioned this in your post Smiley Wink

Here it is.

0 Kudos
Message 9 of 18
(5,989 Views)

Hi KC,

Thanks for the VI. I just hooked it up to a basic vi that I wrote. Could you check if I hooked it up correctly? Thanks. I was also wondering what does the do-while loop do if both inputs for the or gate are false. I see that in this case, it continuously loops until the iteration is greater than the # of bytes I specified and then the error that comes out as a time-out, but I was wondering what the function of the do-while loop does along with the shift registers.

I've tested out your program and it works perfectly. Smiley Happy

I also tried both cases of adding a terminator and not adding one, and the received string is still the same and no error occurred. Do you think it would be okay to not send a terminator in my query/command string, although the manual states to add a terminator at the end of every string (I know. silly question Smiley Tongue)

Thanks a lot for the help,

Sammy

0 Kudos
Message 10 of 18
(5,956 Views)