Communication to the different ElecX modules can make use of different protocols and hardware interfaces. If no standard protocol fits the application, then the following standard can be used. It is based on pure old fashion ASCII and is intentionally nothing new or revolutionary, it has the goal to allow testing it by a human being using a terminal. The philosophy is: Computer should adapt to humans not the other way around. It does not depend on any technology, so it can be used on top of RS232, Bluetooth, Telnet.
Bytes are framed using \n terminated lines. Characters used are printable ASCII characters. There are delimiters, that can split the lines in words. The comma or semicolon will be used as delimiter and allows using space as regular character.
A command can be an ASCII string without any delimiters. Some commands are more complex and contain multiple words separated by delimiters.
As response to a command it response with lines of data to be responded if any, and then a line with OK. If the command can not be processed it responds with an ERROR.
If the command produce multiple replies lines of reply, then OK;<command>
will be sent as last line telling that the command has been processed completely.
Plug and play is an issue so the following lines serving as commands have to be implementation:
Table 1. Generic commands
Command | Description |
NAME | Respond with name of the node |
VER | Respond with with the version |
LOC | Respond with a location string |
UID | Respond with its unique ID |
RECEIVE | Responds with every implemented not generic command that can be received |
SEND | Responds with very implemented command that can be sent |
HEART | Is a periodically heartbeat, knowing |
START;<name of the node> |
Is sent after a reset of the node |
DEBUG;<debug info> |
Is used for development |
ERROR;<reason> |
Responds an erroneous condition |
HOME | Responds with the url or email of the developer of the device |
RESET | Resets the node, no OK gets since makes reset (e.g. Wdog reset) before |
Some non volatile data needs to be modified. This is done with the set and save command. This writes into EEPROM that has a limited life time in the range of 100000. To void damaging the EEPROM with too frequent write cycles, not all parameters are written directly into EEPROM using SET. Those parameters use two steps to be updated SET to modify them in RAM and SAVE to update the EEPROM :
Table 2. Generic set commands
Command | Description |
SET;UID;<32ASCII> |
Sets the unique id |
SET;LOC;<location string> |
Sets the location string, that might be a physical post address or a logical name that identifies equal nodes |
SET;HEART;<n> | If n is 0 then no heartbeat are sent, otherwise every n seconds a heard beat is sent. This is used to monitor that the node is healthy and alive |
SET;DEFAULT | Sets the non volatile parameters to factory default. Depending on the implementation can produce a reset to the microprocessor to reinitializing it. |
SAVE;<name of parameter> |
Saves the parameters to EEPROM where SET just updates them in RAM. Those parameters can be found using the RECEIVE command. |
Future enhancements might be:
binary mode, (byte in byte out, program memory)
setting UART parameters (baudrate, ...)
terminal mode (local echo, line edit, ...)
Commands for a IR transceiver are:
Table 3. IR transceiver
Command | Description |
IRTX;<ppssppss....> |
Sends IR signal and responds with OK;IRTX |
IRRX;<ppssppss....> |
IR signal received |
CARRIER | Responds with the carrier or the IR signal |
SET;CARRIER;<n> |
Sets the carrier frequency of the IR signal in RAM |
SAVE;CARRIER | Saves the carrier frequency of the IR signal to EEPROM |