The simulation system of the single-chip microcomputer motor speed measurement system uses the T1 counter in the single-chip microcomputer to count the speed pulses. Timer T1 works in the external event counting mode to count the speed pulses; T0 works in the timer mode. The count value is read once every 1 s. This value is the frequency of the pulse signal. According to formula (1), the speed of the motor can be calculated. The software system of the speed detection device mainly includes: the speed measurement main program, the data processing subroutine and the display subroutine. After the single-chip microcomputer is powered on, the system enters the ready state. First, it is initialized, then the pulse data is read for calculation, and the speed is displayed on the LCD. Enthusiasts who need this simulation and C language program can learn from the website in the upper left corner of the article picture.
The simulation of the single-chip microcomputer motor speed measurement system adopts the frequency measurement method "M method" to measure the motor speed. That is, within a certain measurement time T, the number of pulses m1 generated by the pulse generator (instead of the input pulse) is measured to measure the speed. The calculation formula is as follows: n=60m/TP, where: P-is the number of pulses generated by the pulse generator when the shaft rotates one circle; n-speed unit: (r/min); T-timing time unit: (seconds). In this method, the measurement accuracy is due to the fact that the timing time T and the pulse cannot be guaranteed to be strictly synchronized, and whether the complete cycle of the external pulse can be measured within T, which may cause a quantization error of one pulse. Therefore, in order to improve the measurement accuracy, T must be long enough. The timing time can be pre-set according to the measurement object. If the setting time is too long, the accuracy can be improved, but in the case of faster speed, the number of pulses counted increases (when the number of code disk holes is fixed), which limits the range of speed measurement. If the setting time is too short, the measurement accuracy will be affected to a certain extent.
Software design ideas for the speed part: The P3.5 port of the AT89S52 microcontroller receives the signal from the sensor. The circuit consists of a display circuit, an AT89S52 microcontroller, a microcontroller clock circuit, a reset circuit, etc. The interrupt service program INT0, the software needs to solve the counting of the timer T0 and the coordination of the external counter T1. Since the speed range of the measurement is large, both low speed and high speed must be taken into account. The software workflow: The sensor detects the number of pulses of the motor turning one turn, which is sent to the microcontroller by the P3.5 port of the microcontroller, and counted by the internal counter T1 of the microcontroller. When the counting is started, a signal TR0=1 is sent. When the internal timer T0 starts, TH0 and TL0 are set to 0.
Previous article:Digital tube display 51 single chip microcomputer DS18B20 temperature measurement source program and simulation
Next article:AT89C51 single chip DC motor PWM speed control program
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- if(Data==1)start=1; Why is there no space after if and before start in this sentence? This will not cause errors during compilation.
- Xiaomi Robot Vacuum Cleaner Features and Chip Parameters
- [Raspberry Pi 4B Review] Raspberry Pi 4 pin functions and operation methods
- Live: Embedded to Cloud Journey with PIC and AVR MCUs from the Microchip Ecosystem Part 2
- Purgatory Legend-RAM War
- [CY8CKIT-149 PSoC 4100S Review] + Familiar with the development environment
- How to write program control for AT28C64
- Motor control design, accuracy? resolution? arc minutes?
- External interrupt and time interrupt count 0-999 displayed on the digital tube example
- 618 big promotion, Keysight1688 online store, share on WeChat Moments to enjoy gifts!