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.
- Simple LED advertising light circuit
- LED Night Light
- Common electrical circuits: frequency-selective (bandpass) amplifier circuit
- Circuit diagram of a differential amplifier circuit
- Homemade 100-base addition and subtraction counting circuit
- Design circuit of voltage inverter using PWM
- Broadband transconductance operational amplifier and buffer OPA660 common emitter (common-E) amplifier circuit
- Linear power amplifier circuit composed of RF2132
- Tremolo Amplifier Circuit
- Human body bioelectric signal preamplifier composed of INA102
- Digital display timing circuit
- Control ladder diagram of advance and retreat mechanism
- Fish tank intermittent oxygenation timer circuit
- Staircase wave signal generation circuit composed of ring counter and digital-to-analog converter
- LED display control circuit diagram in the counter
- 4-digit LED display driver UP, DOWN counter
- Presettable hexadecimal up and down counter
- Frequency divider composed of counter and RS flip-flop
- Cascade down counter
- Use counter to make timer circuit diagram