View Full Version : RS 232 serial communication
June 3rd, 2002, 12:06 PM
Can anyone explain to me how I can write a program that will be sent through my COM1 (RS232) port. I want to send commands (from program) to a temperature controller. example command: *W012003E8, where controller will recognize this as to change setpoint to 100C. I hope my question is clear. Thanks in advance to all who respond.
June 3rd, 2002, 12:50 PM
Your primary source of information will be the manual from the temperature controller manufacturer concerning the serial interface. A typical manual will have the example using the 'Hyperterminal' accessory on most PC's. Some will also show a BASIC example. To use this you would need some type of BASIC. I understand that Microsoft's old 'QBASIC' is still available on the net somwhere. Otherwise, using Visual BASIC would be a more modern alternative. I know this is very general but it's a start.
June 3rd, 2002, 02:08 PM
Bernie's pretty much got it nailed. Here's just a few more tidbits...
I've found the old windows terminal (winterm.exe) a little easier to use than Hyperterminal. If you've got it, I'd suggest using that one instead.
Before you attempt to do any programming, load your terminal program and try to make it talk to your device. Once you've got your baud rates matched up and you've figured out the syntax of your commands, then you can start programming. That'll make troubleshooting a whole lot easier.
I've tried using Visual Basic to write a serial communication application before, but I haven't had much luck. I can send data without much trouble, but I tend to lose data when I try to receive. Visual Basic is very event driven and I haven't figured out how to trigger my code when the device starts talking back (Does anyone have a sample app., by the way?). If you're a VB guru, you might have more luck. Otherwise, try using QBasic or batch files.