Electronics for Newbies: Basic serial communication

I have basic serial communication working! It turned out to be reasonably straightforward.

On the hardware side, it was a pretty simple wire-up of the SIO, with the only even vaguely non-trivial part being the cross-over between the SIO pins and the TTL-level RS232 USB module thing (yes, I'm not even bothering with a MAX232 level converter and real RS232 connector - nowadays USB is going to be more convenient). I swapped TX and RX, and CTS and DTR. Apparently the super-cheapy FTDI USB serial breakout boards prefer to break out DTR over RTS because of some Arduino reason I wasn't paying attention to. One nice thing about using USB is that you get 5V power. And given the low power consumption of CMOS, I can happily run my little computer off the USB-supplied power.

On the software side, it was a simple case of initialising the SIO's registers, and writing routines to read and write characters, polling to make sure the appropriate buffers are non-empty and empty respectively. Initialisation was made more fun by the data sheet being vague about the 'write registers' for control. Register 0 is used to set which register number will be read/written for the very next read/write, but this is explained somewhat implicitly. Code example? Don't be silly. Anyway, once that was in place I could write a very simple piece of code to do comms. No flow control, no interrupts.

So, the next features to test will be getting the flow control working, and making it work on an interrupt-driven basis. However... the next piece of code I plan to write is a hex loader. I've reached the point where, in theory, I should be able to load code onto it through the serial port, and then execute it. This should help shorten the development cycle, so it's what I'll do next. Then I can use that to develop the rest of the I/O stuff. Hopefully at that point I'll be able to port BASIC to it. Just like a real little computer.

Posted 2013-11-14.