Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I read temperatures from a serial port using LabVIEW?

167 views
Skip to first unread message

UMN CEMS

unread,
Apr 9, 2008, 4:10:07 PM4/9/08
to
I have 28 thermocouples measuring the temperatures of various trays in a distillation column.  The thermocouples are connected to a few different CBCom 8 Channel Voltage and Thermocouple Input Modules (Model CB-7018), which are then connected to a CBCom Isolated RS-232 to RS-485 Converter (Model CB-7520) that connects to the computer via a serial cable (9 pins).
 
My goal is to have the 28 temperatures continuously displayed in LabVIEW (version 8.5).
 
However, this is my first time using LabVIEW with a serial port, so I am unsure when, and whether or not I need to, use the various Serial functions under the Instrument I/O.  I'm also confused on what all the inputs to the functions mean.
 
Any help/suggestions would be greatly appreciated.
 
Thanks!

UMN CEMS

unread,
Apr 9, 2008, 4:40:09 PM4/9/08
to
I am pretty familiar with LabVIEW already, just not with aquiring data using Serial Ports (I've written a process control program and a DAQ program using FieldPoint modules).  I already opened and looked at the basic serial read/write example and did various searches on NI on how to use the serial read/write functions, but I still don't quite understand how it all works together.
Any other help/suggestions from anyone would be great!
Thanks.

UMN CEMS

unread,
Apr 9, 2008, 5:10:08 PM4/9/08
to
I guess I'm not exactly sure what 'parity' and 'flow control' are or what their functions are.   Also, I am unsure of what I am supposed to write to the device in order for it to read and individually display all of the 28 different temperatures.
 
When running the Basic Serial Write and Read VI, my settings are the default values which match my port properties (baud rate=9600, data bits=8, parity=none, stop bits=1.0, flow control=none, delay before read=500) and the 'string to write' is *IDN?\r\n.  However, nothing is displayed in the 'read string' or 'bytes read' boxes during a run.  Is this because the 'string to write' is wrong?
 
Thanks for your help!

UMN CEMS

unread,
Apr 10, 2008, 3:10:06 PM4/10/08
to
Thank you for the link to the user manual.  It is a very helpful learning tool (considering there is no hard copy to be found in our lab).
 
Thanks for your suggestions as well... I changed the 'termination char' input to 13 to signify a carriage return.  However, no matter what code I enter into the 'string to write' box, I still don't get an output in the 'read string' box and the 'bytes read' is always 0.  I'm not sure if I'm entering the code incorrectly or if I have the wrong settings for the VISA Configure Serial Port.  The settings I'm using are the same as those mentioned in an earlier message (9600 Baud, 8 Bit, No parity, 1 stop, no flow) and an example of a code I used in the 'string to write' box (with Normal Display) is: $AAM(cr), with AA being 00, 01, 02, 03, etc..., when I try to read the module name.
 
On p.20 of the manual, it shows the Command Format as (Leading)(Address)(Command)[CHK](cr).  Is (Leading) the delimiter character and (Address)=AA, or are they something different and the delimiter character and AA are actually part of (Command)?
 
Thanks again for your help!  I appreciate it!

UMN CEMS

unread,
Apr 10, 2008, 5:40:04 PM4/10/08
to
I really have no idea how to even check to see if checksum is enabled or disabled on the modules.
 
Also, I ran HyperTerminal and did a serial port test, which resulted in me being able to see double characters.  But, when I plugged the cable back in and sent the command $01M, it didn't return anything (I also tried 00, 02, 03, etc...).  I know that there's communication with the modules, because there's another program on the computer that is able to acquire and display all of the various temperatures. 
 
I'm assuming that the problem is with the code I enter in 'string to write'?? .... At least that could be a simpler fix.  Any other suggestions?
 
Thanks again!

Ravens Fan

unread,
Apr 11, 2008, 1:40:05 PM4/11/08
to
I thought NI-SPY did other programs as well, but I am probably mistaken. I hadn't tried it on non-NI software myself.
Other people on the forum have mentioned Portmon, a shareware program that I think will do that.  Search the forum or the web for that.

smercurio_fc

unread,
Apr 11, 2008, 2:10:05 PM4/11/08
to
UMN CEMS wrote:I really have no idea how to even check to see if checksum is enabled or disabled on the modules.
Thanks again!Accodring to the manual, checksum should be disabled by default. Try the attached VI. I've set up default values for the VISA Resource Name, assuming you have an alias set up in MAX for COM1. You probably do. The command is to get the firmware version. Not sure about your module number. There's an option to add a checksum. Unfortunately, the documentation isn't all that clear on what kind of checksum calculation it's expecting, or what format to use. So, I assumed a simple "sum of ASCII values of each character", and a hex formatted string because the checksum is limited to 2 characters.As Ravens Fan mentioned, Portmon is an alternative to NI Spy if you're tracing an app that's not using VISA. You can find it <a href="http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx" target="_blank">here</a>. Be sure to run it and have it connect to your serial port before you run LabVIEW and your VI.


Untitled 12.vi:
http://forums.ni.com/attachments/ni/170/315689/1/Untitled 12.vi

UMN CEMS

unread,
Apr 14, 2008, 1:40:08 PM4/14/08
to
I tried running the VI you posted, but nothing ever appeared in&nbsp;'read buffer'&nbsp; (I changed the module address and&nbsp;tried it with and without checksum).&nbsp; There was never an error, but&nbsp;I received&nbsp;code&nbsp;1073676294&nbsp;with the source VISA Read in Untitled%2012[1].vi.
&nbsp;
Also, I downloaded Portmon and used it to trace serial activity when running the already-in-use program that successfully reads and displays the temperatures, as well as when running LVs Basic Serial Write and Read VI.&nbsp; Attached is the data from Portmon after running these two different programs (#1-27395: Distillation Experiment (not using VISA); #36377-36528: LV Basic VI), but I'm not quite sure how to interpret it (ie. is the Request (4th) column what is sent to/from the serial port?).&nbsp; I did notice, however, that in the LV section of data there is nothing in the Request column that indicates "Read" (not sure if that's significant or not).
&nbsp;
Thanks to both of you for your suggestions/help!


UNITOPS04-14-08.txt:
http://forums.ni.com/attachments/ni/170/316080/1/UNITOPS04-14-08.txt

UMN CEMS

unread,
Apr 15, 2008, 11:10:08 AM4/15/08
to
Attached is the Portmon file from running your VI without (lines 0-37)&nbsp;and with (38-end)&nbsp;checksum.&nbsp; Both times still resulted in nothing displayed in the 'read buffer' box,&nbsp;but gave the same code (1073676294) and source (VISA Read in Untitled%2012[1].vi.)&nbsp; (And both times I entered '#01')
Any other ideas?
Thank you!!!


Serial 04-15-08.txt:
http://forums.ni.com/attachments/ni/170/316329/1/Serial 04-15-08.txt

UMN CEMS

unread,
Apr 16, 2008, 3:10:09 PM4/16/08
to
Thank you again for all your help and suggestions!&nbsp; Everything was very insightful and very much appreciated.&nbsp; I'm not sure what I'll do from here, but we'll see what happens...
&nbsp;
Thanks again!
0 new messages