Instructions for serial communication using I/O ActiveX Control

Open the port:
Result = IO1.Open("COM2:", "baud=9600 parity=N data=8 stop=1")

"COM2:" is the name of the port.
"baud=9600" specifies how fast the data is sent.*
"parity=N" specifies an error detection protocol.*
"data=8" specifies how many data bits are sent in a packet.*
"stop=1" specifies how many bits terminate a packet.*

Set type of handshaking:
Result = IO1.SetHandshaking(HSMethod)
Where 0 = None, 1 = Xon/Xoff, 2 = Hardware*

Handshaking is a method of "holding off" or "preventing" communication when a device is not ready to receive data.

Do the I/O:
Result = IO1.WriteString("Hello World" + Chr(13) + Chr(10)) 'Sends "Hello World" to a printer or other device.
String = IO1.ReadString(30) 'Reads data from a port. Typically a request for data precedes this command.

Close the port:
Result = IO1.Close()

*NOTE: These settings MUST match the settings of the device you are communicating with.

ASCII Code Table

Home Page | Site Map | Copyright (c) 1998 by JSPayne of Cortland NY