8-bit Digital computer-(00)
Clock module
Hola everyone,
I am up with my new blog on the Clock module, which is part of my 8-bit computer project inspired by Ben Eater. The clock module is a part that helps the computer circuits to step through one cycle at a time. This clock module is built using a 555 IC Timer.
555 IC Timer:
It is an integrated circuit that consists of three 5 kΩ resistors used to split the +Vcc across two comparators and an S-R latch, and a discharge transistor. Let's discuss them in detail.
Exploring the 555 IC Timer:
The 555 IC Timer is built with three 5 kΩ resistors, which tends to be the reason for its name. On applying 5 volts, we get the voltage divider across the resistors. There is a drop of 1.67 volts across the first resistor and 3.33 volts across the second resistor, which is clearly shown below.
And these voltages are taken as one of the inputs in the comparators. 3.33 volts in the positive terminal of the second comparator and 1.67 volts in the negative terminal of the first comparator, which play a significant role in the SR Latch action.
Each comparator consists of two inputs, Positive and Negative. The output is to be considered from the terminal, which consists of a greater voltage. The comparator is in the ON state if the positive terminal is at a higher voltage, and vice versa for the OFF state. And that output is given as input in the S-R Latch as SET and RESET.
The other inputs in the comparator are threshold, which resets the S-R latch when its voltage is above 2/3 of +Vcc (5 volts in our case), and trigger, which triggers the set in the S-R latch when its voltage goes below 1/3 of +Vcc (5 volts in our case).Now let’s get to the S-R latch:
SR Latch:
S-R latches are two cross-coupled NOR gates or NAND gates with complementary outputs Q and Q’. It is asynchronous circuit and depends only on the comparators input and sets and resets in our circuit. A circuit diagram, truth table and the practical implementation of it are shown below:
Putting it all together:
We have the 555IC timer in three modes:
# Astable mode-
Continuously oscillates between high and low values without any external trigger
# Monostable mode-
Stays in a stable state until triggered externally or manually.
# Bistable mode-
It is of two stable states and can switch between the modes.
Astable mode:
The idea:
We want to capitalize on the idea of the time taken by the capacitor to charge and discharge. We need the right combination of resistor and capacitor (RC Circuit).
Here, The capacitor and resistor are connected in series, and the capacitor can get charged and discharged depending on the position of the switch connection, which in our case is a 555 IC timer, where the inputs are given in the comparator at threshold and trigger.
Building Up:
As we need the periodic oscillations, we are using the voltage drop during the charging and discharging of the capacitor as input for the comparator Co1 and Co2 to vary their values in a periodic way and switch between set and reset in the latch.
The capacitor voltage shifts between 3.33 and 1.67 volts until the latches shift, which is shown below.
When the capacitor discharges below 1.67 volts switch should connect to supply and capacitor should start charging. When the capacitor charges above 3.33 volts switch should disconnect from supply and capacitor should start discharging.
The capacitor of 1 microfarad is inserted at pin 2. The voltage between pin 2 and pin 6, which are the negative and positive of comparator 1 and 2, respectively.
And the resistor of 100 kΩ is connected between pin 6 and 7, giving the potential difference needed for the comparators. And 1 kΩ is connected at pin 7 to give the potential difference from the power supply and the current to flow. Also, the two resistors are selected so that the time period goes symmetrical, the 100 kΩ resistor contributes only to the discharging time period, and both resistors contribute to the charging time period. So the resistors are kept in such a way that the contribution of the R5 resistor is very low compared to that of the R4.
We are using an LED with a 220 Ω resistor as R6 connected to pin 3 to get the oscillating output signal.
Working it out:
On applying 5V at +Vcc pin 8, there is a potential drop across the resistors giving the inputs to the two comparators. Three resistors of 5KΩ are connected in series with each other, which gives a voltage drop of 1.67 volts across the R1 resistor and 3.33 volts across the R2 resistor.
In the first comparator Co1, 1.67 volts are connected to the positive terminal, and the negative terminal is connected to pin 2 internally, where no voltage is initially applied. Similarly, in the second comparator Co2, 3.33 volts are connected to the negative terminal, and the positive terminal is connected to pin 6 internally. As the first comparator is in the ON state, the S-R Latch is in the SET position, and the LED will continuously glow.
In this way, to get to the real deal, giving the power supply 5v across the externally connected resistors and the capacitor connected to pin 2, which is internally connected to the negative terminal of comparator Co1, and the capacitor gets charged until the voltage crosses 1.67 volts at the negative terminal of comparator Co1, which resets the latch, and the LED goes OFF as the voltage at the positive terminal of comparator Co2 increases and the capacitor current discharges at the transistor internally at pin 7 as the base current is triggered in that common emitter transistor. Once it is completely discharged, the voltage goes lower than 1.67 volts at comparator Co1, the latch sets on, and the LED goes on with the charging of the capacitor, making the cycle continuous.
And the LED goes ON during the charging of the capacitor and goes OFF during the discharge of the capacitor, which is clearly shown below in the graphs generated by the oscilloscope.
Calculating the time period for LED ON and OFF is found by calculating the time period for charging and discharging the capacitor.
By substituting the values, we get the total time period as 3.4477 seconds.
Now,
As we know, the capacitor charges to 3.33 volts and discharges to 1.67 volts from 3.33 volts. This can be verified using the equations above.
The next thing that we have to handle is changing the time period of the signal, which can be done by changing the resistance, which is apparent from the equation written above. So for that, we are changing the resistance of R4 using a potentiometer connected to it and pin 7. By increasing the resistance, the time period increases, and the clock tick of the computer can be increased or decreased according to our wishes which is shown in the image below:
Finally, the link of the output video is attached below:
What if I try to generate the pulse by clicking the button myself every time…..? How to handle this situation.
Let's get on with the remaining modes in the upcoming blog.