Close
0%
0%

FSM Serial Keyboard

9600 baud keyboard, with no cpu

Public Chat
Similar projects worth following
This uses a self-clocking ROM, containing a state machine, scans a 4x4 keyboard, transmitting pressed characters as 9600 baud ASCII characters.

So, I decided I wanted to make a 16 key keyboard that output its data as 9600 8N1 serial.... But I didn't want to use a microcontroller for it...

Well, seems like a good time to try applying a self-clocking ROM to an FSM right!?

The basic idea:

- Take a ROM, assemble an oscillator with one input/output of the ROM as the inverter for the oscillator.

- Feedback, thru a latch, 3 bits of the output to the input as a state machine loop. (16 states should be enough for a 10 bit transmission + overhead, the plan is to use the oscillator as the 4th bit.)

- Input the 4 rows and columns from a scan-free keyboard into the ROM via a latch (so it can hold the value while it does the transmission)

Assembly:

 To do this requires a 32k ROM for input count being used, but I want to use the 28xx series ROMS (EEPROM) and I dont have any 32k, so next up is the 28C64, which I do have. OK.

I don't need an 8 bit latch for the FSM, so a 74174 is fine (6 bits)

For the keyboard latch a non-transparent 8 bit latch will be needed 74ls574 will do this quite well.

<place all the chips in breadboard>

First step is to assemble the oscillator and FSM counter to make sure they works ok.

And everything comes up great.

The next test is to set up the state machine more (this first test was partial code) and make sure that when a keypress is simulated, it will attempt a transmission and wait for the user to release the key before going back into a scan loop.

And here I hit a snag.

The 3 bit state machine did what its supposed to, but was not trying to send the data properly, or properly clocking the line to the keyboard sampling latch.

Because of the way I'd used the oscillator as the 3rd FSM counter bit, and the feedback latch that only latched on the rising clock edge, only half the 16 states were actually available.

The solution was to allow the oscillator to run on dedicated lines, and use a set of 4 dedicated lines for the state counter. OK

In the process, the feedback latch needed different timing, I needed yet ANOTHER output as an inverted-clock-line (actually non-inverted), which I had to delay just a bit more for everything to behave. OK.

Sorry, I'm missing the breadboard images, it seems I forgot to take a few pictures. Regardless, the state machine does what its supposed to.

Adding the keyboard:

 This uses a scan-free keyboard so that the FSM doesn't have to really do anything too fancy. Its easily implemented with a few transistors and resistors.

I also had fun reverse engineering the keyboard to the point I could distinguish the keys in the FSM.

With the previous testing, that all worked great. The last item was to tune it to 9600 baud.

WOW you know what, 9600Hz is SLOW, granted, the oscillator was now running at twice that, but oof.

The final oscillator was an LC Pi, 1uF capacitors (I know, right?) and a 1mH (I know, right?) inductor. Merely bumping a circuit like that on a breadboard sends the frequency spinning off into space. So, to tune it, I set up the scope the the cursors indicating the correct timing of the serial waveform, swapped parts till the frequency was close, then repeatedly poked at it with my finger until it was operating at a close-enough speed (but I got it!)

That last image is actually before I tuned it, with all the scope lines coming off for the debug process.

Playing with it.

So I had just obtained a 5V, 9600 baud ASCII speaking FVD display. Perfect for testing! 

yup, it works!

I will include the source code for generating the state machine image. The state machine itself works be repeatedly clocking the sample latch of the keyboard until a valid keycode is detected. Once a valid key is found, the serial code is transmitted one bit at a time across 10 states. Once the complete code has been sent, it again resamples the keyboard, but repeats its sampling until there are no more keys pressed.

This can be made smaller. I'm pondering a small flash ROM and a 74xx16374 to produce...

Read more »

ROMLib.h

library for ROM LUTS and FSMs

x-chdr - 567.00 bytes - 02/03/2023 at 05:08

Download

makefile

makefile, see makefile

makefile - 59.00 bytes - 02/03/2023 at 05:08

Download

ROMLib.c

library for ROM LUTS and FSMs

x-csrc - 1.02 kB - 02/03/2023 at 05:08

Download

main.c

Program for generating the serial transmission FSM

x-csrc - 6.68 kB - 02/03/2023 at 05:08

Download

output.bin

The file built by the main.c program. 64k image.

octet-stream - 8.00 kB - 02/03/2023 at 05:07

Download

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates