Close

Hardware Flow Control

A project log for Toy BASIC Computer

BASIC Programming Language on a PIC18F26K22

Steve TonerSteve Toner 08/06/2019 at 19:110 Comments

Hooked one of these up to a Cadetwriter at VCF West and found out a couple of things:  (1) The Cadetwriter doesn't like to operate at 300 baud & (2) the hardware flow control I implemented is incomplete at best.

I tried it at 300 baud initially because I knew the Cadetwriter only prints at 15cps.  I was not aware that it can run at high baud rates and has quite a bit of output buffering.  Well, it turns out that the processor they use in the Cadetwriter (Teensy 3.5), though it claims to operate at 300 baud, is actually off by something like 200% at that selected rate.  We switched to 9600 and it worked fine.  Except we had to disable hardware flow control on the Cadetwriter because it implements it properly and the Toy BASIC Computer doesn't.

I had to think back about what I was trying to accomplish when I created this thing...

Background: When I was developing this originally, I was using HyperTerminal on a laptop as the interface.  This let me write BASIC programs and save them on the hard drive of the laptop and then load them into the Toy BASIC Computer before the flash memory was implemented.  But the Toy BASIC Computer couldn't keep up with the input from the laptop.  This is the result of the compilation process that takes place when you hit Return after entering a line of code.  To save RAM (of which there is very little on the PIC processor) and improve runtime speed, keywords are converted to a byte code and stored in memory that way.  Anyway, this resulted in my having to implement some form of flow control on the inbound side.  I didn't bother with the outbound side.

Of course, I had forgotten all this when I was configuring the Cadetwriter.  I remembered that I had implemented hardware flow control, so told it to use RTS/CTS flow control.  And it didn't work.  Until we disabled flow control, then everything was happy :)  Oh, and I also found out there are actually two kind of hardware flow control (apparently the standard was changed somewhere along the line), both of which the Cadetwriter implements.  RTS/CTS is the original, now obsolete standard while RTR/CTS is what is in use today.  So it's possible that if I had selected RTR/CTS instead of RTS/CTS when I configured the Cadetwriter it would have worked...

"The nice thing about standards is that you have so many to choose from." - Andrew Tannenbaum



Discussions