design requirement

Design main roads and branch roads respectively , And meet the traffic light rules of both parties , That is, when the main road passes, the branch road is in the state of no passage . Only the main road is allowed to pass each time 30 second , And from the main road ( Immediate trunk road ) Release only each time 20 second , There are the following rules between them :

1) The green light indicates that it is passable , Red light means no traffic ( That is, the red light stops , pass at a green light )

2) Every time the green light turns red , The yellow light comes on first 5 second ( At this time, the red light status of the other traffic light remains unchanged )

3) Digital display shall be provided at intersections , As a time reminder , So that people can grasp the time more intuitively . Specific requirements main , The notification time and the time when the yellow light is on are counted in seconds

4) When the yellow light is on , Yellow light press 1HZ Frequency flashing of

5) Request master , The passage time of the branch road and the time when the yellow light is on are engraved on the 0-99 Any setting between

Design idea

According to design requirements , Can draw a picture 1 Thought block diagram , chart 1 The block diagram is a road traffic diagram drawn according to real life . Traffic lights only play a display role in this design , So it is mainly the module design of time display , Time display controls not only traffic lights but also time display LED, Two different channels interact , Namely “ one ” effect “ two ”, and “ two ” Also function “ one ”. let me put it another way , Is the interaction between the main road and the branch road , And form the circuit of this design , Correct thinking , Start design .

chart 1

Design the overall circuit

As described above , Once the thought is determined, it is easy to design the drawing 2 Circuit diagram of , This design adopts 74LS190D Chips and 74LS164D Chip is the main design control . Limited to the condition that the traffic light is abnormal , The reset control signal is used to cooperate with the two chips to operate in the system at the same time , The effect is similar to that of no addition , However, such addition can ensure that the circuit system can work stably all the time .

chart 2

Find that in this design ,74LS164 The chip is used as a yellow light “ On stage ” When “ On stage ” of , Therefore, the control of the shift register needs to be debugged through the subtraction circuit ( This will be discussed later , Let's assume that I have already told you ), Seconds corresponding to two subtracters , That is, the second speed corresponding to the main road and the second speed corresponding to the branch road is
30s:20s time , And according to the design requirements , The yellow light needs to be at the end 5 Seconds “ On stage ”. So it can be based on more reliable tests , Or use “ Stupid way ” Test the output pins of the shift register one by one , Know that the output is 5s When it comes to the stage, it can be considered as the completion of the design , This time “ Stupid way ”. According to a series of operations, the figure can be obtained 3 Circuit diagram .

chart 3

chart 4 by 74LS190 Chip menu , Not hard to see
74ls190 It uses the same clock signal to complete the counting function through a certain circuit structure . Realizing the function of asynchronous setting under the function of asynchronous parallel setting , The addition counting is realized under the joint action of the enable terminal and the add / subtract control terminal , Subtraction counting function . According to the topic requirements , Input frequency is 1HZ Hour , Reversible counting of addition and subtraction through the control terminal , keep , Number setting and other functions . His inverse operation is used in this design , Subtraction operation .

One chip can make up one LED Subtraction of lamp usage , This time, however, the 4 individual 74LS190 The time for the chip to generate the main road and the time for the branch road . In order to facilitate the design process and design components as simple as possible , Therefore, the time control circuit has been tried for a long time , Finally, draw the figure 5 Circuit diagram , chart 5 Following diagram 6 The conversion circuits of the two circuits cooperate with each other to produce an alternating time signal , Insert the yellow light in the alternating time signals 5 Second signal completes the overall design of the whole circuit .

chart 4

chart 5

chart 6

result

1, Simulation test of circuit

1) Start circuit simulation

chart 7

2) chart 7 Initial state shown , Status when waiting for the yellow light signal

chart 8

3) chart 8 Status when it is a yellow light signal , stay 5 Seconds to enter the yellow light countdown

chart 9

4) chart 9, To wait for a short time again

chart 10

5) chart 10 After yellow light , Enter the next state

6) End simulation

Technology