CH-1092 Belmont, Suisse
Tel +41 21 728-6156, Fax 728-6157
Email , /

File

HEXO serial protocol specifications

The Hexo protocol needs simple routines on the microcontroller and is immediately compatible with any terminal program.

The PC is the master. It sends an HEXO packet and waits for a returned HEXO packet, which may just be a synchronization packet when there is no information to return. Microcontroller reply is immediate.

The HEXO protocol handles a single type of packets: several optional hexa characters followed by an order letter, recognized in the microcontroller as a byte and a 6-bit order. Multibyte data is not supported.

One key advantage of an HEXO device is it can be controlled from a standard hyperterminal configured for the correct data rate. E.g. typing 12H may return 12h and confirm the value 16'12 has been stored somewhere. K may return D4K, meaning a sensor data is 16'D4.

Programming applications on the PC is easy, since the protocol is simple, and most languages have RS2232 communication primitives.

Format

HEXO packets consist of an optional string of hexadecimal characters (Ascii 0..9 A..F or a..f), that encode an 8-bit parameter, followed by a non hexa Ascii letter, interpreted by the microcontroller as a 6 bit command. By default, the parameter value is zero. Only the last two hexa characters are interpreted. For instance, G, 0G, 00G, 000G, 700G, 232103000G send a zero parameter, but the HEXO software can recognize if a parameter has been sent (G and 0G may not trigger the same action).

The order that terminates the number is an Ascii code greater or equal to the code of letter G or g. 25 (codes "G" to "_") plus 24 (codes "g" to "~") orders are possible; they are coded from 0 (for G) to 16'30 (for ~). The slave replies usually (under program control) with the same letter.

The Didelbot version identify upper and lower case orders, and reples with the

Sending and receiving HEXO triple byte

The task receiving an HEXO number will accept any number of hexadecimal characters 0..9, A..F (or a..f), and end at the first non-hexa character. Only letters G..Z .. ^ can be used as order (a version that does nt identify luwer and upper cases add 24 orders). Special signs and control codes of value lower than 16'40 will give unpredictable binary values.

Receiving HEXO orders proceeds by testing the RecFlag:#bHexo bit. When set, SavBin and SavOrder variables have the hexa value 00..16'FF and the order value 0..16'2D. In addition, RecFlag:#bPara is set if at least one Hex character has been typed (00G or 0G clears this flag, but G sets it).

Sending HEXO data is permitted only if the TkSndHexo variable is zero. SavBin and SavOrder values are sent when the TkSndHexo variable is incermented or set to value 1.

If it is required to send only the parameter, the RecHeso:#bNoOrder bit must be set.

If it is requiered to send a space after the packet, RecHeso:#bSpa bit must be set.

If it is requiered to send a CR after the packet, RecHeso:#bCR bit must be set.

If it is requiered to send a LF after the packet, RecHeso:#bLF bit must be set.

DidelBot implementation

Transmission rate is set at 1200 bits/s, no parity, 2 stop bits (low speed due to infrared communication compatibility).

xG different sounds on the buzzer max 7

xxS right speed (starboard=tribord) max 16'24 min -16'24)

xxP left speed (port=babord)

xxV leftand right speed

xxU preselect a speed for orders I J K

yyI Preselect Distance high byte, if different from zero

xxJ Start a straight line of yyxx units (ca 0.27mm)

xxK Start a turn on itself of xx unit (ca ? degrees)

xxY Set the Blinking register (tricky format)

xxZ Hexo mode 10Z noOrder, 20Z add space, 40Z add CR, 80Z add LF

xxO Preset the address of an internal variable

O --> Read variable

T --> xxt Give the angle

L --> xxl Give the distance Low

X --> yyx Give the distance High

Next orders may be supressed to add the 5 sensors value

H --> display the set of parameters related to the IR link

M --> nnm Give the Timout1s value (bit 7 set after every order)

N --> flags (may change)

Not used: Q R W [ \ ] ^

DidelBot WB010 software

At power-up, the processor blinks, bip and send a CR LF + on the serial line.

Then it waits for orders from the push-button or the serial link.

Several short actions on the push-button call for different bips (more tricks later).

One long action cut the power. Power is also off ater 2-4 minutes of inaction.

The serial link accepts the above orders.