Pinout, Ascii-to-binary conversion, Binary-to-ascii conversion – Pololu Wixel User Manual

Page 39: Serial specifications, Parameters

Advertising
background image

Pinout

Pin

Function

P0_3 ASCII_TX

Serial output, transmits ASCII (0–3.3 V)

P0_2 ASCII_RX

Serial input, receives ASCII (0–3.3 V, not 5 V tolerant)

P1_6 BINARY_TX Serial output, transmits arbitrary bytes (0–3.3 V)

P1_7 BINARY_RX Serial input, receives arbitrary bytes (0–3.3 V, not 5 V tolerant)

ASCII-to-Binary conversion

ASCII characters are received on the ASCII_RX pin, converted into the appropriate bytes, and then transmitted on
BINARY_TX. If you want the Wixel to send a particular byte on the BINARY_TX line, then you should send an
ASCII ‘H’ character to the ASCII_RX pin, followed by the two hex digits representing the byte. For example, if you
want the Wixel to transmit the byte 0xFA on BINARY_TX, send the three-byte ASCII string “HFA” to the ASCII_RX
line. This example can be described as:

ASCII string “HFA” → ASCII_RX → ASCII-to-binary conversion → BINARY_TX → byte 0xFA

The delimiting ‘H’ character can be omitted, but we recommend sending it at the beginning of each transmission to
make sure the Wixel is in sync with the device transmitting the ASCII. For example, to send the two bytes 0xFA and
0x1C, you could send the five-byte ASCII string “HFA1C”.

Uppercase and lowercase hex digits are both recognized. You do not need to send any newlines or other ending
delimiters to the ASCII_RX line. The Wixel transmits each byte as soon as the second hex digit is received.

Binary-to-ASCII conversion

Arbitrary bytes are received on the BINARY_RX pin and an ASCII representation of them is transmitted on
BINARY_TX. Whenever a byte is received on BINARY_RX, the Wixel will transmit three bytes on the ASCII_TX
line: the delimiting character ‘H’ is transmitted first, followed by the two hex digits representing the byte. For the
digits A–F, upper case is used. For example, if the Wixel receives 0xFB on BINARY_RX, it will transmit the three-
byte ASCII string “HFB” on ASCII_TX. This example can be described as:

Byte 0xFB → BINARY_RX → Binary-to-ASCII conversion → ASCII_TX → ASCII string “HFB”

The Wixel does not ever omit the delimiting character ‘H’ when transmitting on the ASCII_TX pin.

Serial specifications

The serial interfaces of this app are non-inverted and they use 8 data bits with 1 stop bit. This is called 8-N-1. Any
serial devices connected to the Wixel should use these same settings.

Parameters

• ascii_baud_rate: The baud rate of the ASCII interface (ASCII_RX and ASCII_TX), in bits per second. The
default value is 9600 bps. We recommend not exceeding 115200.

• binary_baud_rate: The baud rate of the binary interface (BINARY_RX and BINARY_TX), in bits per second.
The default value is 9600 bps. We recommend not exceeding 115200.

Pololu Wixel User's Guide

© 2001–2014 Pololu Corporation

9. Wixel Apps

Page 39 of 64

Advertising