LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication problem with Lakeshore 321

Solved!
Go to solution

Hi, there

 

First of all, I would like to apologize if this question has already been answered in the forums, but I haven't been able to find any solution for this situation.

 

I have a Lakeshore 321 temperature controller hooked up to serial port using RJ-11 cable and DE-9 serial interface connector configured as DTE. Since there is no NI certified driver in the NI website, I tried to write my own based on 332 driver. I was able to read data (current temperature) from LS321 for some time last week. But then everytime I tried to read data, it kept giving me error as shown in the attachment.

 

Any help with this issue would be most appreciated!

0 Kudos
Message 1 of 12
(4,812 Views)

Can you put an indicator on the string wire running from the VISA read to the Scan from String?  What data does that show you are receiving?

 

I suspect that the string you are receiving is not in a format that the Scan from String is able to interpret according to the format string.

0 Kudos
Message 2 of 12
(4,810 Views)

@Ravens Fan wrote:

Can you put an indicator on the string wire running from the VISA read to the Scan from String?  What data does that show you are receiving?

 

I suspect that the string you are receiving is not in a format that the Scan from String is able to interpret according to the format string.


Hi, Ranvens

 

Thank you for your response. I put an indicator and it shows as in the attached picture. Actually the error generates in the "Read" function and the indicator shows empty.

Download All
0 Kudos
Message 3 of 12
(4,807 Views)

That's a timeout error.  Meaning data did not come in during the timeout period.

 

Are you sure your command CTDAT? :<CR><LF> is correct?  How about your baud rate, stop bits and parity?  Does your communication protocol put a termination character like a line feed at the end of the data it is sending to the PC?

 

The reason you get the pop up error on the scan from string is that the error output is unwired, and it doesn't know how to interpret an empty string. You should feed the error wire through the scan from string function as well.

0 Kudos
Message 4 of 12
(4,800 Views)

@Ravens Fan wrote:

That's a timeout error.  Meaning data did not come in during the timeout period.

 

Are you sure your command CTDAT? :<CR><LF> is correct?  How about your baud rate, stop bits and parity?  Does your communication protocol put a termination character like a line feed at the end of the data it is sending to the PC?

 

The reason you get the pop up error on the scan from string is that the error output is unwired, and it doesn't know how to interpret an empty string. You should feed the error wire through the scan from string function as well.


Ravens,

 

I checked the manual and "CDAT?" is the current temperature query. And the Terminators for Serial Interface are CR(0DH)LF(0AH). So I guess the problem is baud rate, stop bits and parity?

 

In the manual it is written that:

Connector Type: RJ-11 Connector

Connector Wiring: DTE

Voltage Levels: EIA RS-232C Specified

Timing Format: Asynchronous

Transmission Mode: Half Duplex

Baud Rate: 300, 1200

Hankshake: Software timing

Character Bits: 1 Start, 7 Data, 1 Parity, 1 Stop

Parity: Odd

Terminators: CR(0DH)LF(0AH)

Command Rate: 20 commands per second maximum

 

How should I deal with these baud rate, stop bit and parity? Sorry I'm new to Labview and have no idea about these communication problems. Am I doing right in the attached vi file? But it still gave me error when I tried to read.

 

0 Kudos
Message 5 of 12
(4,796 Views)
Solution
Accepted by clihunc

You'd be better off using the Serial Configure VI.  It will also enable the termination character and set it for you.

 

 

0 Kudos
Message 6 of 12
(4,786 Views)

@Ravens Fan wrote:

You'd be better off using the Serial Configure VI.  It will also enable the termination character and set it for you.

 

 


Finally get it work! Haha.

Thank you for your help and patience, Ravens.

0 Kudos
Message 7 of 12
(4,777 Views)

everything worked but i had a broken wire on the parity part.  i chose the function "Enum Constant" and used the text changer to change it to "Odd".  I re-wired it a couple times to see if it work to no luck.  Please let me know what i am doing wrong.

 

 

0 Kudos
Message 8 of 12
(4,742 Views)

Are you saying you tried to build the enum constant from scratch?

 

Delete your constant.  Right click on the input of the subVI and choose Create Constant.  Now you will have a constant that is the correct enum datatype and is unbroken.  Change the value to Odd.

 

You may also want to do this with some of your other constants.  You have a lot of coercion dots that mean the datatype of the constant you wired in doesn't match the datatype that the subVI is expecting.

 

Also, clean up your wires so that they don't overlap and the purple VISA resource wire doesn't wrap itself all round the subVI.

0 Kudos
Message 9 of 12
(4,729 Views)

Hi,

 

I am trying to control Lake Shore 321 from LabVIEW as well. I wonder if you can send me some example VIs? I am a beginner.

 

Thanks.

 

Ronghui

0 Kudos
Message 10 of 12
(4,520 Views)