02-04-2020 01:05 PM
I'm trying to set up a VI for monitoring and controlling a temperature bath, thermocouple, and hygrometer, that will be used to control a variable humidity, variable temperature, data collection setup. The attached VI is meant to check for any changes in bath Set Temperature, make any changes necessary, then monitor the various temperature/humidity inputs and indicate when they stabilize.
I think everything works except for the serial communication with the temperature bath, which works inconsistently. The probes suggest the commands are going in when they should (i.e. when I make a change), so I think the case structure is functioning properly. When I start the program the bath responds to changes in Set Temperature, but after a few changes it stops responding. I'm also getting strange readings on the Bath Temperature indicator. At first I was struggling to get any communication with the bath, then found success by writing in termination characters as strings, but I think this may also be the source of problems. I attached the pages of the manual relevant to serial control.
Bath: VWR Refrigerated Circulating Bath 89202-982. Same controller as a PolyScience one, which has some useful documentation.
Obligatory: I'm brand new to LabVIEW. Any general comments on the VI are definitely welcome.
02-04-2020 01:52 PM - edited 02-04-2020 01:53 PM
@phil7445 wrote:
then found success by writing in termination characters as strings, but I think this may also be the source of problems.
I think your problem is how you are reading. You need to change the termination character on the VISA Configure Serial Port to be 13 (0xD, Carriage Return). The default is 10 (0xA, Line Feed). Since the instrument is not sending a Line Feed, I am guessing you are getting timeout errors. So add that input to the VISA Configure Serial Port and change your bytes to read on the VISA Read to be more than any message this instrument will put out; I tend to use 50.
Since you are always sending the RT command and then reading the response, you should move that part of the code to be outside of the case structure.
The instrument returns a response to all commands you send. So you should perform a read after you send the set point and verify its response.
I would go so far as to create a VI that is used to send the commands. In it you use Concatenate String to add the Carriage Return character to the command, send the command, and read a response.

02-05-2020 05:53 PM
Thanks a lot! I wasn't thinking about the fact that the instrument sends a response even when I don't care about it (i.e. the !). It seems to be running smoothly now.