Presettable 8-bit counter circuit
Source: InternetPublisher:黄土马家 Keywords: counter Updated: 2024/10/14
Figure 2 is the logic structure of 74LS164. It has two serial data input terminals, which can be used in parallel, or one of them can be used as a data input enable terminal. The input serial data is shifted and latched at the rising edge of the clock.
Figure 3 shows the pinout of 74LS164. The pin functions of 74LS164 are: A1 and A2 are serial data input terminals, QA to QH are 8-bit parallel data output terminals. The rising edge of the clock input terminal is valid, and the falling edge of the reset terminal is valid.
The tasks completed by the AT89S51 microcontroller are: (1) Scan the keyboard to obtain the required preset data. (2) Send the count value to the 8-bit LED display for static display. (3) Perform output control.
Software design ideas and solutions
First, check whether the keyboard is pressed. If it is pressed, the key flag is 1, otherwise it is 0. Then check the s9 key. If the s9 key is pressed, the working flag set_flag is inverted (0 or 1). Later, the program counts, displays the count, controls the output, or scans the keys S1 to S8, displays the preset value, etc. according to the working flag. In this design, keys S10 to S16 are not used. For programming convenience, the 8-bit count value and the 8-bit preset value are
The values are stored in 8 variables. Although the RAM utilization is not high, it is easy for beginners to understand. When the preset value is displayed, the decimal point of the lowest digital tube on the display is lit to show the difference with the displayed count value. When the count value is equal to the preset value, the output (P3.4) is activated to control the load (motor, etc.) to act. Figure 4 is the main program state flow.
- How to identify common mode interference? Methods to eliminate common mode interference
- What are the main types of resistors? Detailed explanation of the functions and uses of resistors
- What is a D flip-flop and how does it work?
- Working principle/characteristics/application fields/equivalent circuit of unijunction transistor
- Causes of PCB deformation How to prevent circuit board bending and warping
- How to build a drag racing timer circuit using a 7-segment display and discrete components
- What is a Demultiplexer
- Star finder battery indicator circuit
- LED Bicycle Lights
- Square wave frequency multiplier (SN15844N, SN7400N)
- Digital display timing circuit
- Simple three-phase brushless stepper motor drive circuit
- Simple long delay timer circuit
- Staircase wave signal generation circuit composed of ring counter and digital-to-analog converter
- High voltage Geiger counter power circuit
- 4-digit LED display driver UP, DOWN counter
- Programmable divider to control counter reset (1)
- Programmable divider composed of counter data selector
- Phase locked loop circuit diagram with counter
- Photoelectric counter and application circuit diagram