Expand I/O capabilities of small homebrew projects with
"IOX" .. an I/O Expander

Serial LCD + Frequency Counter + driver for A/D Converter, Keypad and Digital Potentiometer   



The IOX chip works great with the QuickieLab project board

The I/O Expander is a 28-pin SX microcontroller that is programmed to operate as a slave I/O processor to a host controller in your projects. IOX interfaces peripheral components (LCD, A/D Converter, digital pot, and matrix keypad) to the host processor over a conventional asynchronous serial line. Additionally, the IOX chip has a "frequency counting" capability, providing the host processor with both raw count information and processed frequency values over selectable time gate periods. The IOX chip interfaces to the host processor using a standard asynchronous serial line operating at 2400 baud.

Input and output pins are very precious resources in small digital projects these days. Popular small microcontrollers like the PIC, 8051, SX, BASIC Stamp, etc., may only have 8-to-16 lines of I/O available for use, while we typically have a need to drive LCD displays, LEDs and frequency synthesizers; and read A/D converters, keyboards, shaft encoders and more. Hardware interfacing is the name of the game, and you can never have too much I/O capability on a processor to handle all these tasks.

Well, here’s a relatively simple project called the I/O Expander, or IOX for short, that will greatly ease that I/O pin crunch on your current microcontroller project. At first it looks like a clone of the common “serial LCD” controller – but when you look under the hood, you’ll see an I/O processor that’s chock full of goodies that we use everyday in our ham applications: serial display driver, frequency counting, A/D conversion, keypad processing and digital potentiometer control. Drop this single chip IOX into your next design and you’ll be able to handle a lot more I/O than you originally thought possible.

A Ubicom SX-28 is programmed to be controlled by the host microcontroller of your project using a standard asynchronous serial port running at 2400 baud, thus acting as the host’s “henchman” in performing various I/O functions. The host (e.g., a PIC) issues a simple 1- or 2-byte command over this serial link and the SX processor goes off and does its thing. Sometimes the SX outputs the specified data (to the display or digital pot), while at other times it gathers input data (from the frequency counter, A/D converter, or keypad) and sends it back to the host over that serial port.

The following block diagram illustrates this master-slave concept for expanding the I/O capabilities of a host microcontroller. 

Figure 1:  Block Diagram of I/O Expander in a System

Operation as a Serial LCD Driver

What a joy not having to put all those pesky LCD driver routines in your host processor!  Just have the host send the string to be displayed to the SX chip and let IOX take care of the timing!  The SX chip accepts bytes in the range of 0-to-253 from the host and displays them on the LCD display connected to its own I/O pins. When a special “command” byte of 254 is sent by the host, the SX chip waits for another character which is called the function byte. As can be seen in Table 1: I/O Expander Command-Response Structure, display functions include clearing the display, setting the cursor to home or to a prescribed position, blank display, scroll the display, and more. Thus when the host processor sends a 2-byte sequence of 254 and 1, the display will be cleared of all data.

Operation as a Frequency Counter

The IOX software is designed to count the frequency being applied to its RTCC input pin. Whenever commanded by the host to “read frequency”, the SX chip starts counting.  Then when commanded to deliver counting results to the host, IOX sends back the most recent three-byte accumulation of the applied signal’s frequency. The algorithm is very similar to the measurement routines used in other projects, whereby the software counts transitions on the RTCC pin of the SX chip and accumulates the counts in three internal storage locations. Based on the time base issued by the host processor, the measurement window is shortened or lengthened and the host then multiplies the numbers accordingly when received. Frequencies up to 16 MHz can be measured with 1 Hz resolution, and up to 50 MHz with 4 Hz resolution.

Operation as an A/D Controller

As shown in the detailed schematic of the QuickieLab, a popular and inexpensive analog-to-digital converter is wired to the SX chip’s I/O pins. The IOX software is able to initiate A/D conversions and read the resultant 8-bit data representing the analog signal on the ADC inputs. So if the host processor commands the SX chip to read the A/D (command 80), the I/O Expander initiates an A/D read cycle, awaits data conversion completion, and returns the 8-bit value to the host in response. The host then needs to process that value ranging from 0-to-255 into some meaningful data within its own program.

Operation as a Digital Pot Controller

In a similar manner, a very useful chip called an NV Trim Pot is wired to other I/O pins on the SX chip. When the host sends command 90 followed by another byte ranging from 0-to-99, the IOX software “moves the wiper” of that digital pot to that specified position (corresponding to percentage of rotation of the pot). In this way the host processor can easily control the gain of an amplifier, for example, if the digital pot is wired into the feedback loop of an op-amp.

Operation as a Keypad Processor

The IOX software running in the SX chip may be commanded by the host to read a 4 row by 3 column keypad in one of two ways. First, command 100 instructs the IOX software to merely return the current state of the keypad. If a key is pressed, a binary value in the range of 0-to-12 corresponding to that key is returned to the host as a response byte. But if no key is currently being pressed, a response value of 255 is sent back to the host.

A more conventional mode, initiated by the host sending command 101 to the SX chip, instructs the IOX software to send a key code whenever a key is pressed. This asynchronous operation of sending unsolicited data back to the host is useful in the respect that key presses can initiate operations while the host software is off doing something else. This is like having 12 user-selectable interrupts, and is a powerful addition to the hardware/software developer using the I/O Expander.

Standard Serial Port Talks to IOX

Because commands and data are exchanged over a standard asynchronous serial port, almost any host processor can be easily interfaced to the IOX chip.  Digital levels (TTL) are available on the SX chip for connection directly to the Rx and Tx pins of many host processors, or if an RS-232 serial port is desired (as when using a PC as the host controller), a MAX232 level translator can easily be added to the SX serial data line.

The baud rate of the IOX serial port is hard coded to be 2400 baud because the test implementation of IOX was accomplished using a BASIC Stamp controller, which is relatively slow. The rate can be increased to a maximum of 19.2 Kbps with a simple change to the IOX source code, enabling it to efficiently connect with some fast RISC host processors.

Go Forth and Expand (your I/O)

By using the I/O Expander, you can easily control more hardware peripheral devices than possible with just a PIC, Stamp or 8051 microcontroller. An even more attractive feature is that the software is simplified too – you needn’t worry about A/D conversion, frequency measurement or LCD coding intricacies … it’s all there in the SX chip for you. The IOX source code is provided here and you can add/change routines in support of your own favorite peripheral. If you don’t wish to program the SX chip on your own, you can order it from the NJQRP. Any way you look at it, it’s easy to “go forth and expand your I/O”!

Sorry, we're sold out and this kit is retired. The software source is provided and so you can burn the program into your own SX chip.



Last Modified:  December 17, 2005