
Serial port 2 bits in and
2 bits out.
(using manual Manipulation
of Serial Communication Handshake Lines and SerialStatus function).
Home Page
2 Bits Out
This ActiveX control can be used to
manually
manipulate the hardware handshaking lines of a serial communications
port.
To do this, follow the following steps.
-
Set the state of the control line
before the
port is opened.
-
Open the port.
-
Then assert the control line to the
state
you wish.
Example:
-
'Set output
-
IO1.SerialRTSControl(1) 'or 0 see
SerialRTSControl
documentation at main web page "Functions"
-
IO1.SerialDTRControl(0)
IO1.Open("COM2:", "baud=9600 parity=N data=8 stop=1")
- IO1.SerialRTSControl(5) 'or 6 to
change RTS
state as desired.
-
IO1.SerialDTRControl(5)
-
2 Bits In
Example:
-
'Read input
-
Result = IO1.SerialStatus
-
If (Result And SERIAL_CTS_ON) Then
-
Check1.Value = 1
-
Else
-
Check1.Value = 0
-
End If
-
If (Result And SERIAL_DSR_ON) Then
-
Check2.Value = 1
-
Else
-
Check2.Value = 0
-
End If
Note1:SERIAL_CTS_ON
and SERIAL_DSR_ON need to be
defined
somewhere and set to the correct values. See "Functions"
and SerialStatus() for more information.
Note2: The voltages at the
serial
port are + and - (12 to 15 v typical). Sometimes you can get away
with 0 to 5 volts for an input but it is not guaranteed.
See: Serial
and parallel cable schematics and wiring diagrams.
Copyright (c) 1998 by JSPayne