Connecting virtual and physical serial ports, 70 chapter 7 • serial ports, Figure 7.1 – serial and virtual ports – Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual
Page 71
70
CHAPTER 7 • SERIAL PORTS
Serial I/O
Message System
Virtual Ports
Physical Ports
232 FRONT
485 TBUS
232 TOP
485 TOP
V1
V2
V3
V4
ClickSerialPortConnect
Receive Message Processor
ClickSerialPortReceive
ClickSerialPortTransmit
ClickMsgCreate
Application Specific
Callback Function
ClickMsgAddReceiveTaskToVPort
Figure 7.1 – Serial and Virtual Ports
Connecting Virtual and Physical Serial Ports
The ClickSerialPortConnect function is used to connect a physical serial port to a virtual
serial port. Once a physical serial port is connected to a virtual serial port, it is connected to
all other physical serial ports that are connected to that virtual serial port. There are a total
of four independent physical ports and four independent virtual ports on the Click 500.
The following example demonstrates how to connect virtual ports and physical ports.
ClickSerialPortConnect(V1, _485TOP);
ClickSerialPortConnect(V1, _485TBUS);
ClickSerialPortConnect(V2, _232TOP);
ClickSerialPortConnect(V2, _232FRONT);
While multiple physical ports can be connected to the same virtual port, each physical port
can only be tied to only one virtual port. If multiple physical serial ports are virtually con-
nected, then all data that is transmitted on any one of the physical serial ports is replicated
onto all the ports that are virtually connected.