= The module number to configure port settings for. 2 chars, uppercase 'M' followed by the module/card number.
* eg. ''M1'' = Module/card 1, ''M4'' = Module 4.
* **** = Port number to configure. 3 chars, uppercase 'P' followed by the two digit port number.
* eg. ''P01'' = Port 1, ''P02'' = Port 2.
* **** = The following modes are available:
* ''0'' = Port Off
* ''232'' = RS232 (handshaking determined via the setting)
* ''485H'' = Half-duplex RS485
* ''4XXF'' = Full-duplex RS485 or RS422
* **** = The following baud rates are available:
* 100
* 300
* 600
* 1200
* 2400
* 4800
* 9600
* 14400
* 19200
* 38400
* 57600
* 115200
* 128000
* 256000
* **** = Always ''8'' Data Bits
* **** = The following parity types are available:
* ''N'' = No Parity
* ''O'' = Odd (uppercase letter 'O')
* ''E'' = Even
* **** = The following stop bits are available:
* ''1'' = 1 stop bit
* ''2'' = 2 stop bits
* **** = The following flow control (handshaking) options are available:
* ''0'' = No flow control
* ''1'' = Enable RTS/CTS
=== Reply ===
< [F2][F3]RCOMSPC[F4]|::::::[F5][F5]
The reply will contain information for each port of the module/card, even if only one port was changed. See the definitions for all returned data above.
=== Example ===
// Set Port 01 to RS485 115200 Baud, 8 data bits, no parity, 1 stop bit, no flow control
// For Module 1 in a MOD4 on CFLink ID [11]
> [F2][11][F3]CCOMSPC[F4]M1|P01:4XXF:115200:8:N:1:0[F5][F5]
// Reply
< [F2][11][F3]RCOMSPC[F4]M1|P01:4XXF:115200:8:N:1:0|P02:OFF:9600:8:N:1|P03:OFF:9600:8:N:1|P04:OFF:9600:8:N:1[F5][F5]
// Port 01 is already set to RS485 mode, now we want to set port 02 to 232 mode.
// For Module 2 in a MOD4 on CFLink ID [11]
// This will break the RS485 mode, as it requires both A and B ports combined.
> [F2][11][F3]CCOMSPC[F4]M2|P02:232:115200:8:N:1:0[F5][F5]
// Reply
< [F2][11][F3]RCOMSPC[F4]M2|P01:232:9600:8:N:1:0|P02:232:115200:8:N:1:0|P03:OFF:9600:8:N:1|P04:OFF:9600:8:N:1[F5][F5]
// Error setting port mode, invalid port combination (only port 01 or 03 can be set in RS485/422 mode)
> [F2][11][F3]CCOMSPC[F4]M1|P04:4XXF:115200:8:N:1:0[F5][F5]
// Reply, when previous command was sent from a LANBridge on CFLink ID [02]
< [F2][11][F3]RCOMERR[F4]Invalid COM Mode:02:CCOMSPC:M1|P04:4XXF:115200:8:N:1:0[F5][F5]
===== Transmission Messages =====
==== SPW - Send Serial Data ====
The ''SPW'' (Serial Port Write) command is used to send serial data out a specific port within the module/card.
// Target device: COM4 Module
> [F2][F3]TCOMSPW[F4]|:[F5][F5]
* **** = The module number to send the data via. 2 chars, uppercase 'M' followed by the module/card number.
* eg. ''M1'' = Module/card 1, ''M4'' = Module 4.
* **** = Port number to send the data out via. 3 chars, uppercase 'P' followed by the two digit port number.
* eg. ''P01'' = Port 1, ''P02'' = Port 2.
* **** = This is the actual data you want to send out the serial port. Data cannot contain ''[F5][F5]'' as it will strip all data from that point as per the CFLink protocol End Of Message specifier. When you want to send hex data, it must be already converted to hex within the '''' before sending the CFLink message to the serial port.\\
Note: Only one port can be written to per transmission command.
=== Reply ===
// Replying device: COM4 Module
< [F2][F3]RCOMSPW[F4]|[F5][F5]
If the SPW command is successful, the reply will contain the module/card and port number parameters used for the SPW. The data will not be echoed, in an effort to reduce bus traffic.
=== Example - Sending Serial Data ===
// Send a command out of port 02 of a COM4 module in slot 1 of a MOD4 on CFLink ID [04]
> [F2][04][F3]TCOMSPW[F4]M1|P02:PWRON[0D][F5][F5]
< [F2][04][F3]RCOMSPW[F4]M1|P02[F5][F5]
=== Errors ===
* 003 = Invalid Port Number
* 004 = Invalid Module/card Number
===== Notifications =====
==== SPR - Read Serial Data ====
The ''SPR'' (Serial Port Read) reply contains any data received via a specific port within the module/card.\\
This reply is automatically transmitted whenever data is received.
// Replying device: COM4 Module
< [F2][F3]RCOMSPR[F4]|:[F5][F5]
* **** = The module number that received the data. 2 chars, uppercase 'M' followed by the module/card number.
* eg. ''M1'' = Module/card 1, ''M4'' = Module 4.
* **** = Port number that received the data. 3 chars, uppercase 'P' followed by the two digit port number.
* eg. ''P01'' = Port 1, ''P02'' = Port 2.
* **** = This is the actual data that was received via the serial port.
=== Example - Receiving Serial Data ===
// Receive data via port 1 of a COM4 module in slot 1 of a MOD4 on CFLink ID [04]
< [F2][04][F3]RCOMSPR[F4]M1|P01:MV50[0D][F5][F5]
// Receive data via port 3 of a COM4 module in slot 2 of a MOD4 on CFLink ID [04]
< [F2][04][F3]RCOMSPR[F4]M2|P03:Hello World![F5][F5]
===== Glossary =====
* **Flow Control** - Flow Control is the method that a serial port uses to control the flow of traffic. COM4 only supports RTS/CTS (software) flow control. XON/XOFF is not supported