The following documentation is for COM (serial port) modules and cards.
The COM4 supports up to 4 COM port combinations, with RS232, RS422 and RS485 support, including flow control options.
The default port configuration is 4 x RS232, 9600 Baud Rate, 8 Data Bits, No Parity, 1 Stop Bit, No Flow Control.
The following tables demonstrate the possible port combinations of a single COM4 module:
Legend: | |||
RS232 without handshaking/flow control | RS232 with RTS/CTS | RS485 half-duplex | RS485/422 full-duplex |
|
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
THE FOLLOWING MODES ARE INVALID! | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
The SPC
(Serial Port Configuration) query is used to return the status of the port configurations for the module/card.
> [F2]<ID>[F3]QCOMSPC[F4]<M#>[F5][F5]
M1
= Module/card 1, M4
= Module4.
< [F2]<ID>[F3]RCOMSPC[F4]<M#>|<P##>:<MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>[F5][F5]
Each port on the COM module/card will be included in the reply.
See the definitions for all returned data in the SPC command.
// Query configuration for Module 2 in a MOD4 on CFLink ID [11] > [F2][11][F3]QCOMSPC[F4]M2[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] // Ports 03 and 04 are both off. // Ports 01 and 02 are set to RS232 mode
The SPC
(Serial Port Configure) command is used to setup the configuration of each port within the module.
You can configure multiple ports at once, across multiple modules, using the Port and Module separators.
// Target device: COM4 Module > [F2]<ID>[F3]CCOMSPC[F4]<M#>|<P##>:<MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>[F5][F5]
M1
= Module/card 1, M4
= Module 4.P01
= Port 1, P02
= Port 2.0
= Port Off232
= RS232 (handshaking determined via the <FLOWCONTROL> setting)485H
= Half-duplex RS4854XXF
= Full-duplex RS485 or RS4228
Data BitsN
= No ParityO
= Odd (uppercase letter 'O')E
= Even1
= 1 stop bit2
= 2 stop bits0
= No flow control1
= Enable RTS/CTS
< [F2]<ID>[F3]RCOMSPC[F4]<M#>|<P##>:<MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>[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.
// 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]
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]<ID>[F3]TCOMSPW[F4]<M#>|<P##>:<DATA>[F5][F5]
M1
= Module/card 1, M4
= Module 4.P01
= Port 1, P02
= Port 2.[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 <DATA>
before sending the CFLink message to the serial port.Note: Only one port can be written to per transmission command.
// Replying device: COM4 Module < [F2]<ID>[F3]RCOMSPW[F4]<M#>|<P##>[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.
// 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]
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]<ID>[F3]RCOMSPR[F4]<M#>|<P#>:<DATA_RECEIVED>[F5][F5]
M1
= Module/card 1, M4
= Module 4.P01
= Port 1, P02
= Port 2.
// 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]