01-21-2012 04:35 PM
I would like to write a C++ program to communicate (via rs232) with a temperature oven. I will be using a USB to RS232 adapter. I have never done any serial communication so this is my first trip down this road. I need to setup the serial port on my PC (need the syntax and code) also I need to send commands to the oven and read commands from the oven too.
I'm using the IDE (Code::Blocks) with the GNU GCC Compiler, probably a console application, maybe a Win32 application haven't decided yet. I just need the basics I will try and figure out the rest. Any help in this matter would be great.
What I have read from MANY Google searches is that the serial (rs232) communication is similar to reading and writing to a file. Just need to know how to set everything up.
Thanks any and everyone!!
01-22-2012 05:48 PM
Before you get ahead of yourself, I would want to be able to communicate to the instrument manually. In other words, I would fire up Hyperterminal and make sure I can command and retrieve information from the oven.
If you are using a NI USB to RS232 device which I hope you are, it should include example programs, maybe not for C++ but it should give you an idea.
04-29-2013 08:42 AM
Just out of curiosity, what kind of chamber is it ? I'm having to do the same thing (C++ via RS-232) with a Thermotron chamber. I can do it with LabVIEW 8.0.1. (Couldn't get it to work with LabVIEW 2012, so I reverted, and it worked.)
04-30-2013 08:53 AM
Hi,
a loopback test can be used to troubleshoot serial communications.
04-30-2013 09:58 AM
Try this. It is code that originated from the CVI Examples. Currently I have the "IDEN?\r" query in it, but it worked and responded with the various commands and queries that I sent it. This was originally in LabWindows\CVI 2010, but should function as regular C-Code. (I'm not 100%, though.)