LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Interface commands to Serial device connected via RS--232

Solved!
Go to solution

Hi,

 

I want to read temperature data and input setpoint from/to a temperature calibrator (Fluke 9100s). The device has interface commands that can be used to perform these tasks. I would like to know what function, block or set of functions i should use to send these commands to the device to read the temperature and input setpoints.

 

I have created two Labview VI, which is both kinda the same, and i am attaching it here to get suggestions, and insights. I know the device and the VI is communicating as I am seeing some weird characters appear during runtime in the output. 

Alternatively, is there a method by which i can convert these weird characters possibly into a meaningful result. I could doing something teriblly wrong here too. Would like to know what i am doing wrong here and get some insight into this. Please help me solve this problem.

 

Attaching all the VI's, Manufacturer interface command pages, and runtime results of the VI.

 

Thanks,

themadgreek

Capture1.PNG

Capture2.PNG

d7830627-73b1-4c5f-81be-2c7eac699d32.jpg

c4e66cbb-344a-40e2-af2c-0772d92ae678.jpg

Download All
0 Kudos
Message 1 of 8
(304 Views)

1. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)

 

The VISA Reads until the number of bytes you told it to read are read or the termination character is read.  So you need to set the Termination Character to a Carriage Return (0x13) and just tell the VISA Read to read more bytes than you ever expect in a response.  This way you will know you got a complete message.

 

2. I highly recommend you go watch this video: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 8
(262 Views)

@crossrulz wrote:

1. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)

I think I have seen this before 😁

And here

And here

 

I wonder how many times this has been stated on these forums?

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 3 of 8
(224 Views)

@Frozen wrote:

@crossrulz wrote:

1. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)

I think I have seen this before 😁

And here

And here

 

I wonder how many times this has been stated on these forums?


I have it as a forum macro for a reason...It is also the reason I presented on proper serial port communications, whose link I also turned into a macro.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(212 Views)

Hi @Crossrulz,

 

Thanks for writing here, and being part of the discussion. It was good knowledge from the your video. I'm still pretty new to all this cool stuff, so my understanding and knowledge is limited. So based on your recommendation i made changes to the Vi and i still cant seem to have it work. I am attaching the vi here, could you let me know what i am doing wrong here? Also, please let me know of any suggestions and recommendations you have for me.

 

Thanks

themadgreek

 

0 Kudos
Message 5 of 8
(186 Views)
Solution
Accepted by topic author themadgreek

A few thoughts...

1. Change all of your settings controls into constants.  You appear to have the wrong default termination character (should be 13, 0xD).  Setting these things into constants helps remove ambiguity for those who are trying to figure out your code.

 

2. You likely do not have the termination character in your "write buffer".  So concatenate the End Of Line constant to your write buffer before the VISA Write.  I would go so far as to create a VI that does this for you so you can reuse it (see #3).

 

3. You should create a VI for each command/query you want to perform with this device.  You can then use constants and remove ambiguity.

 

4. Once you have that done, you can use an Event Structure to detect value changes (set point value, buttons, etc.) and call the VIs you just made.  This will make things a lot easier on you as the user.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(168 Views)

Hi @crossrulz,

 

Thanks for the thoughts and suggestions. Based on your recommendations I re-worked the Vi to the best of my understanding, and now its working. There is still some rectifications to be done, as the buffer holds the previous values and some of the commands doesn't seem to work or no results in the read buffer. But I'm able to read and input setpoint temperature values, change units etc. 

 

I'm attaching the draft VI (that kinda worked for me) here for any suggestions, recommendations or for anyone who had the same problems as I had.

 

Note: This VI is not the final code to execute all the commands for the Fluke 9100S temperature calibrator. I'm working on it.

 

Thanks,

themadgreek

0 Kudos
Message 7 of 8
(127 Views)

I cleaned up your VI.

 

As far as the buffer still holding values, you could add a button to just perform a read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(110 Views)