vb code serial communication

C

Thread Starter

Chris Ryan

Hello List,
Before I begin beating my head against the wall, does anyone have any sample vb code to read data from a serial device on com1? I'm using Hyperterm to display the data now but wish to capture it in excel or access. Any help would be appreciated


Chris "RYNO" Ryan
PPI - Slab Group - Engineering
Bethlehem Steel Corp.
Sparrows Point Div.
410.388.7817
 
J
Chris,

What device are you using to capture the data? Is is a PLC, PC or what? I've used VB for capture from a SLC 500 Basic module and also some scanners and been very successful.

Microsoft has a sample VB terminal program in its examples section of VB titled VB term. Also, if you're somewhat familiar with VB, you can use the MSCOMM object to do just about whatever you want with the serial ports on a PC. Search for MSCOMM under your VB help for examples (if you have Visual Studio it'll also point you to VBTerm. I'm not sure if beginner VB has Visual Studio, but I know VB Professional does.)

Hope this helps,

John Kelley
 
Visual Basic Professional comes with a small terminal program which should show you all you need to know. You will find it under samples\mscomm\ and it is called VBTerm
 
J

Jean-Yves Fiset

Hi,

One way might be to use the mscomm32.ocx component that comes with VB; the component is quite flexible and you can find sample code in the \samples\CompTool\MSComm directory under VB.

Good luck.

Jean-Yves Fiset
 
E

Edgar F. Hilton

If in Unix, here is all that you need (one command):

cat /dev/ttyS0 > logfile

this will read your com port and put all the data into your logfile.

I hope that this helps.
--
Edgar F. Hilton FSMLabs, Inc.
voice: 850.893.0300 www.fsmlabs.com
fax: 206.350.4EFH www.rtlinux.com
 
Top