DemoPad Centro C - IP Network API Reference Manual

Centro C Front
DemoPad Centro C
Table of Contents

Revision 1.0 - 10th November 2023

IPv4 Address

When using factory default settings, the Centro C presents itself as a DHCP Client. Thus, it will be allocated an IPv4 IP address from a local DHCP server.

If you cannot establish the IP address of the Centro C, see Troubleshooting

Connection Details

The Centro C presents a TCP Server in order to establish a connection with a TCP socket client application. Ref RFC793.

Data is sent raw (uncooked) and is therefore plaintext. Further application abstraction, such as using a Telnet application is not required. The use of Telnet for RS-232 bridge ports is strongly discouraged.

No more than 4 concurrent TCP socket clients can be supported simultaneously on each Centro C TCP port. Attempting to add more than 4 concurrent connections will result in the 5th attempt being rejected.

By default, TCP sockets are persisted by the Centro C indefinitely - there is no timeout value. This can be altered using the Communication Protocol.

TCP client applications can use either persistent or 'one-shot' connection methods.

The Centro C listens on 7 discrete TCP socket ports. Connection to a specific port is dependant on the desired function.

TCP Port List:

  • 7500: Communication Protocol
  • 7501: RS-232 Port 1 bridge
  • 7502: RS-232 Port 2 bridge
  • 7503: RS-232 Port 3 bridge
  • 7504: RS-232 Port 4 bridge
  • 7505: RS-232 Port 5 bridge
  • 7506: RS-232 Port 6 bridge

Data sent / received via TCP ports 7501 through 7506 are a direct representation of all data sent / received via the related RS-232 port. Data is sent / received “as-is”. Communication on these ports is simply a bridge. There is no processing on these ports. The Centro C Communication Protocol does not apply.

All data bytes from 0x00 through to 0xFF are supported.

Data sent / received via TCP port 7500 conforms to the Centro C communication protocol listed below.

Protocol examples will represent data using the ASCII printable character set.

All commands sent from a TCP socket client are to be terminated with a <Carriage Return> character byte. Depending on your TCP socket client application, this may be represented by:

  • 0x0D (Hex)
  • \r (Escape notation)
  • $0D (Hercules)
  • \x0D (Escape byte notation)

Example:

$RELAYSTATUS 1\x0D

All responses sent from the Centro C are terminated with <Carriage Return><Line Feed> character bytes. Depending on your TCP socket client application, this may be represented by:

  • 0x0D 0x0A (Hex)
  • \r\n (Escape notation)
  • {0D}{0A} (Hercules)
  • \x0D \x0A (Escape byte notation)

Example:

RELAY 01 OPEN\x0D\x0A

Upon establishing a connection with a TCP socket client, the Centro C will send the welcome message:

Centro-C Firmware Version : V1.7.5\x0D\x0A

N.B. The firmware version shown may differ - see $VERSION

Command List

The command list syntax and examples will represent data using the ASCII printable character set.

Command syntax will use value substitution bounded by the “<” and “>” symbols.

Each line of data in syntax and examples are delimited by the termination symbols, see Communication Protocol.

$VERSION - Return system firmware version

Use this command to return the current Centro C system firmware version

Command syntax:

$VERSION

Command example:

$VERSION

Return syntax:

Centro-C Firmware Version : V<vmaj>.<vmin>.<vpat>

Where:

  • <vmaj> = 0-9
  • <vmin> = 0-9
  • <vpat> = 0-9

Return example:

Centro-C Firmware Version : V1.7.5
$RC - Set a relay to a closed state

Use this command to close a specific relay and optionally add a delay time before the relay closes.

Command syntax:

$RC <relay_number>

or

$RC <relay_number> <delay_time>

Where:

  • <relay_number> = 1-12

    The number of the relay with reference to the product chassis labelling

  • <delay_time> = 1-600

    The optional delay time in multiples of 100ms

Command example 1:

Close relay 3

$RC 3

Command example 2:

Close relay 5 after 2 seconds

$RC 5 20

Return syntax:

RELAY <relay_number> CLOSED

or

RELAY <relay_number> CLOSED WILL BE DELAYED IN <ms> MILLISECONDS

Followed by the delay time, then

RELAY <relay_number> CLOSED

Where:

  • <relay_number> = 00-12
  • <ms> = 100-60000

Return example (using command example 2):

RELAY 05 CLOSED WILL BE DELAYED IN 2000 MILLISECONDS
RELAY 05 CLOSED
$RO - Set a relay to an open state

Use this command to open a specific relay and optionally add a delay time before the relay opens.

Command syntax:

$RO <relay_number>

or

$RO <relay_number> <delay_time>

Where:

  • <relay_number> = 1-12

    The number of the relay with reference to the product chassis labelling

  • <delay_time> = 1-600

    The optional delay time in multiples of 100ms

Command example 1:

Open relay 3

$RO 3

Command example 2:

Open relay 5 after 2 seconds

$RO 5 20

Return syntax:

RELAY <relay_num> OPEN

or

RELAY <relay_num> OPEN WILL BE DELAYED IN <ms> MILLISECONDS

Followed by the delay time, then

RELAY <relay_num> OPEN

Where:

  • <relay_num> = 00-12
  • <ms> = 100-60000

Return example (using command example 2):

RELAY 05 OPEN WILL BE DELAYED IN 2000 MILLISECONDS
RELAY 05 OPEN
$RT - Toggle a relay state

Use this command to toggle (invert the state of) a specific relay and optionally add a delay time before the relay toggles.

Command syntax:

$RT <relay_number>

or

$RT <relay_number> <delay_time>

Where:

  • <relay_number> = 1-12

    The number of the relay with reference to the product chassis labelling

  • <delay_time> = 1-600

    The optional delay time in multiples of 100ms

Command example 1:

Toggle relay 3

$RT 3

Command example 2:

Toggle relay 5 after 2 seconds

$RT 5 20

Return syntax:

RELAY <relay_num> <relay_state>

or

RELAY <relay_num> TOGGLE WILL BE DELAYED IN <ms> MILLISECONDS

Followed by the delay time, then

RELAY <relay_num> <relay_state>

Where:

  • <relay_num> = 00-12
  • <ms> = 100-60000
  • <relay_state> = OPEN or CLOSED

Return example (using command example 2, relay initially in OPEN state):

RELAY 05 TOGGLE WILL BE DELAYED IN 2000 MILLISECONDS
RELAY 05 CLOSED
$RP - Pulse a relay

Use this command to close a specific relay for a specific time before the relay opens.

Command syntax:

$RP <relay_number> <delay_time>

Where:

  • <relay_number> = 1-12

    The number of the relay with reference to the product chassis labelling

  • <delay_time> = 1-600

    The delay time in multiples of 100ms

Command example:

Close relay 5, then open after 2 seconds

$RP 5 20

Return syntax:

RELAY <relay_num> CLOSED
AFTER <ms> MILLISECONDS, RELAY <relay_num> WILL BE OPENED

Followed by the delay time, then

RELAY <relay_num> OPEN

Where:

  • <relay_num> = 00-12
  • <ms> = 100-60000

Return example:

RELAY 05 CLOSED
AFTER 2000 MILLISECONDS, RELAY 05 WILL BE OPENED
RELAY 05 OPEN
$RELAYSTATUS - Return the current state of a relay

Use this command to return the current state of a specific relay.

Command syntax:

$RELAYSTATUS <relay_number>

Where:

  • <relay_number> = 1-12

    The number of the relay with reference to the product chassis labelling

Command example:

Return the state of relay 3

$RELAYSTATUS 3

Return syntax:

RELAY <relay_num> <relay_state>

Where:

  • <relay_num> = 00-12
  • <relay_state> = OPEN or CLOSED

Return example (if the current state of relay 3 is OPEN):

RELAY 03 OPEN
$TRIGGER - Return the current state of all binary input ports

Use this command to return the current state of all binary input ports.

Command syntax:

$TRIGGER

Command example:

$TRIGGER

Return syntax:

INPUTSTATUS <b1><b2><b3><b4><b5><b6><b7><b8><b9><b10><b11><b12><b13><b14><b15><b16>

Where:

  • <b1> = 0-1

    The state of input 1 with reference to the product chassis labelling

  • <b2> = 0-1

    The state of input 2 with reference to the product chassis labelling

  • ...
  • <b16> = 0-1

    The state of input 16 with reference to the product chassis labelling

A closed circuit to the GND terminal represents a 1 state. An open circuit represents a 0 state.

Return example (closed circuit on each even input number, open circuit on odd inputs):

INPUTSTATUS 0101010101010101
$TRIGGERRELAYS - Set up automatic relay states based on a binary input change

Use this command to set up an automatic state allocation for all product relays based on a state change of a binary input port.

Command syntax:

$TRIGGERRELAYS <input_number> <input_state> <r1><r2><r3><r4><r5><r6><r7><r8><r9><r10><r11><r12>

Where:

  • <input_number> = 1-16

    The number of the binary input port with reference to the product chassis labelling

  • <input_state> = OPEN or CLOSE

    The binary state transition

    OPEN = Input port transitions from closed to open state

    CLOSE = Input port transitions from open to closed state

  • A closed circuit to the GND terminal represents a CLOSE state. An open circuit represents an OPEN state.

  • <r1> = 0 or 1 or T or -

    The desired state of relay 1 with reference to the product chassis labelling

    0 = Relay open

    1 = Relay closed

    T = Relay toggle

    - = Relay unaffected

  • ...
  • <r12> = 0 or 1 or T or -

    The desired state of relay 12 with reference to the product chassis labelling

Command example:

When input 5 transitions from closed to open state, open relay 1, close relay 2, toggle relay 3 and leave all other relays unaffected

$TRIGGERRELAYS 5 OPEN 01T--------

Return syntax:

TRIGGERRELAYS <input_number> <input_state> <r1><r2><r3><r4><r5><r6><r7><r8><r9><r10><r11><r12>

Return example (using command example)

TRIGGERRELAYS 5 OPEN 01T--------
$IREMIT - Emit an IR code from an IR output

Use this command to emit an IR code from a specific IR output port

Command syntax:

$IREMIT <port> <freq>,1,1,<p1on><p1off><p2on><p2off><...><pNon><pNoff>

Where:

  • <port> = 1-12

    The number of the IR output port with reference to the product chassis labelling

  • <freq> = 4E20 - EA60

    The hexadecimal value of the modulation or carrier frequency in Hz

  • <p1on> = 01 - FFFF

    The hexadecimal count value of modulation periods for burst pair 1 on state

  • <p1off> = 01 - FFFF

    The hexadecimal count value of modulation periods for burst pair 1 off state

  • <p2on> = 01 - FFFF

    The hexadecimal count value of modulation periods for burst pair 2 on state

  • <p2off> = 01 - FFFF

    The hexadecimal count value of modulation periods for burst pair 2 off state

  • ...
  • <pNon> = 01 - FFFF

    The hexadecimal count value of modulation periods for the last burst pair on state

  • <pNoff> = 01 - FFFF

    The hexadecimal count value of modulation periods for the last burst pair off state

The on count is the number of periods of (1/modulation_frequency) that equals the burst pair on period.

The off count is the number of periods of (1/modulation_frequency) that equals the burst pair off period.

Relationship with Pronto CCF HEX format IR codes

Example HEX code:

0000 0067 0000 0015 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 03f6

First word: 0000 - Not used

Second word: 0067 - This is a Pronto CCF format hexadecimal value, that can be represented in decimal (𝑥) representing the modulation frequency (ƒ), where

𝑥 = 1000000 / (ƒ * 0.241246)

The modulation frequency value (ƒ) is used directly for <freq>, so for this example we can rearrange so that

ƒ = 1000000 / (𝑥 * 0.241246)

ƒ = 1000000 / (103 * 0.241246)

ƒ = 40244Hz

and represent as a hexadecimal value, rounded to the nearest integer

<freq> = 9D34

Third word: 0000 - Not used

Fourth word: 0015 - Not used

The remaining words are the hexadecimal burst pair values and can be substituted as a direct sequence to the $IREMIT command after removing any leading zeros.

Command example 1:

Send Pronto CCF HEX format IR code from IR output port 2

0000 0067 0000 0015 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 03f6
$IREMIT 2 9D34,1,1,60,18,18,18,30,18,30,18,30,18,18,18,30,18,18,18,18,18,30,18,18,18,30,18,30,18,30,18,18,18,18,18,30,18,18,18,18,18,30,18,18,3F6

Relationship with Global Cache format IR codes

Example GC code:

sendir,1:1,1,38000,1,1,341,168,22,19,22,62,22,62,22,62,22,62,22,62,22,62,22,19,22,62,22,19,22,19,22,19,22,19,22,19,22,19,22,62,22,19,22,62,22,62,22,62,22,62,22,62,22,62,22,19,22,62,22,19,22,19,22,19,22,19,22,19,22,19,22,62,22,760

sendir,1:1,1, - Not used

38000, - This is the modulation frequency in Hz. This value can be used directly for <freq> when represented as hexadecimal

1,1, - Not used

The remaining comma-separated values are the decimal burst pair values and can be substituted as a direct sequence to the $IREMIT command when represented as hexadecimal

Command example 2:

Send GC format IR code from IR output port 5

sendir,1:1,1,38000,1,1,341,168,22,19,22,62,22,62,22,62,22,62,22,62,22,62,22,19,22,62,22,19,22,19,22,19,22,19,22,19,22,19,22,62,22,19,22,62,22,62,22,62,22,62,22,62,22,62,22,19,22,62,22,19,22,19,22,19,22,19,22,19,22,19,22,62,22,760
$IREMIT 5 9470,1,1,155,A8,16,13,16,3E,16,3E,16,3E,16,3E,16,3E,16,3E,16,13,16,3E,16,13,16,13,16,13,16,13,16,13,16,13,16,3E,16,13,16,3E,16,3E,16,3E,16,3E,16,3E,16,3E,16,13,16,3E,16,13,16,13,16,13,16,13,16,13,16,13,16,3E,16,2F8

Return syntax:

IR OK

Return example:

IR OK
$COMSTATUS - Return the UART parameters for an RS-232 port

Use this command to return the current UART parameters set for a specific RS-232 port

Command syntax:

$COMSTATUS <com_number>

Where:

  • <com_number> = 1-6

    The number of the RS-232 port with reference to the product chassis labelling

Command example:

Return the current UART parameters for RS-232 port 4

$COMSTATUS 4

Return syntax:

COM <com_number> IS SET TO : <baud>,8,<parity>,<stop>

Where:

  • <baud> = 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 or 230400

    The baud rate of the UART

  • <parity> = N, E or O

    The use of the parity bit. None, Even or Odd

  • <stop> = 1-2

    The number of stop bits

Note that on the Centro C, the size of the data byte is fixed at 8 bits.

Return example:

COM 4 IS SET TO : 115200,8,N,1
$COM_SET - Set the UART parameters for an RS-232 port

Use this command to set the UART parameters for a specific RS-232 port

Command syntax:

$COM_SET <com_number> <baud>,8,<parity><stop>

Where:

  • <com_number> = 1-6

    The number of the RS-232 port with reference to the product chassis labelling

  • <baud> = 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 or 230400

    The baud rate of the UART

  • <parity> = N, E or O

    The use of the parity bit. None, Even or Odd

  • <stop> = 1-2

    The number of stop bits

Note that on the Centro C, the size of the data byte is fixed at 8 bits.

Command example:

Set the UART parameters for RS-232 port 4

$COM_SET 4 19200,8,N,1

Return syntax:

SET COM <com_number> <baud>,8,<parity>,<stop>

Return example:

SET COM 4 19200,8,N,1
$SETIP - Set static values for IP address, netmask and gateway IP address

Use this command to set static values for host IP address, netmask and gateway IP address. This will disable the DHCP client service.

If you are not careful, this is an easy way to lose communication with the Centro C product. If you encounter a problem after using this command, see Troubleshooting

Command syntax:

$SETIP <host_ip> <netmask> <gateway_ip>

Where:

  • <host_ip> = IP Address

    The host IP address in dotted octet format, .e.g. 192.168.2.1

  • <netmask>

    The netmask in dotted octet format, .e.g. 255.255.255.0

  • <gateway_ip> = IP Address

    The gateway IP address in dotted octet format, .e.g. 192.168.2.254

Command example:

$SETIP 192.168.10.106 255.255.255.0 192.168.10.254

There is no return using this command. The new setting will be set after a few seconds. Note, you will need to establish a new TCP socket connection.

$ETH_MODE 1 - Enable the DHCP client service for the network interface

Use this command to set the ethernet interface to use the DHCP client service. This will allow the Centro C to obtain the host IP, netmask and gateway IP from the local DHCP server.

This will replace any statically assigned host IP, netmask and gateway IP values.

If you are not careful, this is an easy way to lose communication with the Centro C product. If you encounter a problem after using this command, see Troubleshooting

Command syntax:

$ETH_MODE 1

Command example:

$ETH_MODE 1

There is no return using this command. The new setting will be set after a few seconds. Note, you will need to establish a new TCP socket connection.

$IPCONFIG - Return the current network interface details

Use this command to return the current Ethernet interface details

Command syntax:

$IPCONFIG

Command example:

$IPCONFIG

Return syntax:

ETHERNET MAC : <mac_address>
Address Type : <type>
IP : <host_ip>
SN : <netmask>
GW : <gateway_ip>
Telnet COM 1 PORT : 7501
Telnet COM 2 PORT : 7502
Telnet COM 3 PORT : 7503
Telnet COM 4 PORT : 7504
Telnet COM 5 PORT : 7505
Telnet COM 6 PORT : 7506

Where:

  • <mac_address> = MAC Address

    The MAC address in hyphenated hexadecimal format, e.g. 40-d8-55-1a-53-72

  • <type> = DHCP or Static IP

    The addressing mode of the Network interface

  • <host_ip> = IP Address

    The host IP address in dotted octet format, .e.g. 192.168.2.1

  • <netmask>

    The netmask in dotted octet format, .e.g. 255.255.255.0

  • <gateway_ip> = IP Address

    The gateway IP address in dotted octet format, .e.g. 192.168.2.254

Return example:

ETHERNET MAC : 40-d8-55-1a-53-72
Address Type : Static IP
IP : 192.168.2.1
SN : 255.255.255.0
GW : 192.168.2.254
Telnet COM 1 PORT : 7501
Telnet COM 2 PORT : 7502
Telnet COM 3 PORT : 7503
Telnet COM 4 PORT : 7504
Telnet COM 5 PORT : 7505
Telnet COM 6 PORT : 7506
$TIMEOUT_MODE - Set or return the TCP socket server connection timeout mode

Use this command to set a 5 minute timeout for all TCP client connections. For each client, if the client application sends no data for 5 minutes the Centro will disconnect the TCP socket.

This command can also be used to return the current state of the timeout.

Command syntax:

$TIMEOUT_MODE <en_timeout>

Where:

  • <en_timeout> = 0, 1 or ?

    1 = Enable timeout

    0 = Disable timeout

    ? = Return current timeout status

Command example 1:

$TIMEOUT_MODE ?

Command example 2:

$TIMEOUT_MODE 1

Return syntax:

IP TIMEOUT MODE IS <timeout_state>

Where:

  • <timeout_state> = DISABLED or ENABLED

Return example (using command example 1, timeout is disabled):

IP TIMEOUT MODE IS DISABLED

Return example (using command example 2):

IP TIMEOUT MODE IS ENABLED
$RELEASE_CONNECTION - Release a TCP socket from the server

Use this command to disconnect a specific TCP Socket port. The Centro will disconnect all clients connected to the specified port and release the socket(s) for reuse.

Command syntax:

$RELEASE_CONNECTION <port>

Where:

  • <port> = 7500, 7501, 7502, 7503, 7504, 7505, 7506

    The TCP socket port to be disconnected

Command example:

Disconnect TCP socket port 7502

$RELEASE_CONNECTION 7502

Return syntax:

TELNET PORT <port> RELEASED

Return example:

TELNET PORT 7502 RELEASED
$FACTORY - Reset the Centro C to factory default values

Use this command to return the Centro C to factory default settings.

If you are not careful, this is an easy way to lose communication with the Centro C product. If you encounter a problem after using this command, see Troubleshooting

Command syntax:

$FACTORY

Command example:

$FACTORY

Return syntax:

Factory DATA Reset PROCESS...Done, Please reboot system !

Return example:

Factory DATA Reset PROCESS...Done, Please reboot system !
$REBOOT - Reboot the Centro C

Use this command to reboot the Centro C and release all TCP socket connections.

Command syntax:

$REBOOT

Command example:

$REBOOT

There is no return using this command. All TCP clients will be disconnected within 20 seconds. Note, you will need to establish a new TCP socket connection.

Command Errors

If the Centro C encounters command data that contains an error, the returned data depends on the error:

Incorrect command keyword

Wrong Command!!

Incorrect command parameters

Command failed

Update Firmware

Updating Centro C firmware will also restore the product to its factory default settings. Only update firmware if instructed to by DemoPad Support.

To update the firmware on the Centro C, please download the latest firmware ZIP file from this link: Latest Firmware: Centro C

To update the Centro C firmware

  • Connect a USB cable to the USB Mini A socket on the Centro C and connect the cable to a computer.
  • Turn off the power to the Centro C. After a few seconds turn on the power to the Centro C.
  • On the USB host computer, the Centro C will enumerate as a mounted drive containing no files.
  • Copy the firmware ZIP file to the Centro C mounted drive. You do NOT need to extract the ZIP file.
  • After a few moments, the Centro C will update and the mounted drive will disconnect from the host computer.
  • The update should only take a few seconds. During this time there is no LED light activity on the product.
  • Observe the status of the LED lights on the front of the Centro C product. The firmware update is complete when the LEDs flash alternately.
  • Turn off the power to the Centro C and disconnect the USB cable before turning the Centro C on again.

Troubleshooting

I do not know the IP address of the Centro C or I cannot connect to the Centro C

  1. Power off the Centro C. Wait a few seconds. Turn on the power to the Centro C.
  2. Observe the DHCP address allocation for the Centro C on your DHCP server.

If you cannot see a DHCP-allocated address for the Centro C or suspect that the Centro C has been set to use a static IP address, you can force the Centro C to enable the DHCP client by restoring factory default values. To achieve this, update the firmware of the product - see Update Firmware

Some data sent / received from a RS-232 port is incomplete or incorrect

  1. Check that you are using a raw TCP socket client application. Using Telnet or another application layer to abstract or wrap data through additional protocols or standards will likely result in some data not being represented correctly.
  2. Check the UART parameters set for the RS-232 port are correct relative to the 3rd-party equipment connected by RS-232. This includes the baud rate, number of bits used in the data byte, the use of a parity bit and the number of stop bits.