Excel 2010 Vba Serial Port Communication

Posted on by admin
Recently, I got helpful advice on how to install and register MSComm32.ocx for a serial communication project I am working on. I have succeeded in getting it on my home Windows XP machine where I write code, and a PC at work running Win' 98. The work PC is actually hooked up to the serial device, a pump controller. Since then, I have established communication with the controller using Hyperterminal.
  1. Excel 2010 Vba Serial Port Communication

The measurement data transmits every 60 secs via rs232. I route this to a PC using a serial / usb convertor and can view the data strings as they arrive on a com port in hyper terminal. However I don't know how to capture this 'com port' data in excel - though I believe it's possible. Anybody able to point me in the right direction with this? How to Read RS232 to Excel Macro VBA Data Acquisition. This tutorial explains how to establish a bidirectional real-time communication between Microsoft Excel and your RS232 COM Port devices like a Scale, Proximity reader, Barcode reader. Download hoyle board games 2005 free full version.

MSComm VBA Excel comms with serial port Hi - I'm an engineer working on trying to control a process using electrical resistance as a feedback. I had a development controller running in Excel VBA communicating with a Fluke 8845A digital multimeter.


The controller has its own serial protocol using ASCII characters. Commands from the PC begin with a 'start of text' <STX> character and end with a 'carriage return' <CR>. The controller responds with data, followed by <CR>. The body of PC transmissions may have 1- or 2-letter commands, sometimes followed by numeric parameters. The controller resonds with an 'acknowledge' <ACK> symbol, a 'negative acknowledge' <NAK> symbol, or numeric data.
Now that I am familiar with the controller protocol, I'm moving on to VBA code. I'm slowly working through a site, http://www.yes-tele.com/mscomm.html, a number of MicroSoft Knowledge Base articles, and code samples provided by Expert Exchange members, to get started writing actual subroutines. Perhaps someone can help me 'jump start' this part of the project with some simple code samples?
For example, I'd like to ask the controller what setup program is assigned to pump drive 1, '<STX>N1<CR> and display the numeric response from the controller, '#<CR>', with the carriage return removed. I envision starting with something like,
Private Sub Form_Load( )
With MSComm1
.Settings = '9600,O,7,2' 'baud,parity,data bits,stop bits

Excel 2010 Vba Serial Port Communication

Excel 2010 Vba Serial Port Communication
.CommPort = 1
.PortOpen = True
End With
although I've also seen statements like,
Open 'COM1:9600,n,7,2' For Input as #1
Is this equivalent to the previous 'With' statement?
Also, the protocol says the use of handshaking when communicating with the controller is optional. Should I ignore the Handshaking property, or set it to something?
A little advice, up front, should help me get this coding started.
Thanks.