This app uses the Wixel’s two UARTs to convert between ASCII characters and “binary” data with arbitrary bytes. This can be useful if you are programming a controller with a serial interface that is limited to only transmitting ASCII characters, but you want to control a device with a serial interface that requires you to send arbitrary bytes between 0x00 and 0xFF. This app can act as a translator between your controller and such a device.
Download the Serial ASCII-to-Binary App (v1.0) (17k wxl). Open it with the Wixel Configuration Utility, choose your parameters, and then write it to a Wixel. See Section 4 for more information on how this is done.
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.
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.
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.
Caution: The Wixel’s I/O lines are not 5V tolerant. You must use level-shifters, diodes, or voltage dividers to connect the Wixel to outputs from 5V systems. Also, avoid drawing more current from an I/O line than it can provide (see the discussion of maximum pin current in Section 1.a). Avoid connecting multiple output pins together.
The Wixel does not support the RS-232 voltage levels typically used by DB9 serial ports. The Wixel’s I/O lines, including the RX and TX lines, operate on voltages between 0 and 3.3 V. To connect the Wixel to an RS-232 serial signal, you will need additional level-shifting and inverting hardware like the Pololu 23201a serial adapter (RS-232 serial is inverted; the Wixel’s serial interface expects non-inverted serial).