Introduction
This project started as the final project for this class and grew to include the state machine project. My idea for the final was to build a tic tac toe game using 74LS series IC chips. To include the state machine project, I included the use of a microcontroller as an AI player.
Design
I used Multisim Live to design the project. Since the whole project would be too slow to fit on one schematic, I designed the two main components separately.
Set Mechanism
Each 74ls74an chip has two rising edge d-flip-flops in it. There were a total of 3 states that needed to be represented: X, O, and empty. Because of this, each D-flip-flop represents one grid in tic-tac-toe. If one is on, it means X, if the other is on, it means that the state is O, if neither is on, it means that the space is unoccupied.
Win Condition Mechanism
I used AOI logic to check whether or not somebody had won in the game.
Microprocessor Selection
In initial tests of the algorithm used to find the next optimal move for the non-human player, the available Arduino Uno boards took about 10 seconds, worst case, even after extensive optimization. In the end, I decided to just throw some money at it to solve the problem. For a total of $4, I bought a raspberry pi pico off of Digikey. The pico is not only half as expensive as the Arduino, but has a 32 bit architecture (as opposed to the atmega's 8) and has a 130ish MHz clock compared to the Arduino's 25ish. With the new addition, the algorithm runs in about 88ms, which is acceptable.
Logic Level Conversion
One of the major problems I had with this project was converting between the Pico's 3.3V logic and the rest of the circuit's 5V TTL logic and vice versa. In order to convert from 5V to 3.3V, I used a voltage divider. Since, according to the datasheet, the maximum current draw for the SN74LS74an is 0.4mA. Based on calculations, I needed a 15k and 10k resistor divider (which is doubled from the minimum for safety). In order to go from 3.3V to 5V in order to send clock signals, I used the CD74HC4051be MUX/DEMUX chip as a logic shifter. Essentially, I set one channel to 5V high and set the address line to point to that input. Then, I connected the active low enable pin to the target GPIO output on the Pico. Whenever the enable went low, the common output went to 5V and whenever it went to 3V, the common output went to 0V.
Demonstration
Coming soon...