There are many types of timers on the market, and some manufacturers can customize them according to customer requirements. However, in order to save costs, some businesses do not control the production quality very well, and do not do a good job in chip selection and the reliability test of the entire system. In addition, the digital tubes currently used in the market are of poor quality and poor anti-interference ability, and cannot be used in complex environments. The single-chip digital timer is small in size, high in precision, and strong in anti-interference ability, and is suitable for complex working environments.
1 Hardware Design
1.1 System Structure
The system is mainly composed of a power module, an input part, a control part and a display part. The system structure block diagram is shown in Figure 1.
1.2 MCU Minimum System Design
The control part uses a 40-pin MCU PIC16F887, which uses a reduced instruction set, Harvard bus structure and two-stage pipeline. It is low-priced, highly reliable, low-power and small in size. The minimum MCU system is shown in Figure 2.
The minimum system of the single-chip microcomputer consists of a PIC16F887 single-chip microcomputer, a reset module, a 4 MHz external crystal oscillator, a pin header, etc. Among them, pins 7, 8, and 28 are VDD power terminals, connected to the working power supply DC 5 V. Pins 6, 30, and 31 are VSS ground terminals, directly grounded; pins 32 and 33 are connected to a 4 MHz external crystal oscillator, and the capacitor is 22 pF; the VPP reset terminal is connected to the working power supply with a pull-up resistor.
1.3 Display
The display part uses industrial-grade 4-digit 7-segment digital tube dynamic display, which can save I/O ports and has low power consumption. The circuit diagram of the display part is shown in Figure 3.
1.4 Input
The input part has two independent start/stop terminals and reset terminals, which do not interfere with each other. The input channel uses the optical coupler TLP521 for isolation, and the signal is transmitted in one direction. The input and output terminals are completely electrically isolated, and the output signal has no effect on the input terminal. It has strong anti-interference ability, stable operation, long service life, and high transmission efficiency. The input circuit is shown in Figure 4.
1.5 Power supply
The power supply part is a 24 V to 5 V regulated isolation power supply module with a wide input voltage range and reliable and stable operation. The input voltage range is DC 18 to 36 V, the output voltage is 5 V, and the output power is 5 W. The circuit diagram of the power supply part is shown in Figure 5.
2 Software Design
The timer control program uses interrupt triggering mode, and selects timer 1 for timing. It has two independent start and stop ports and corresponding independent reset ports, named "Start/Stop 1", "Start/Stop 2", "Reset 1" and "Reset 2". Each control port uses DC24 V level triggering working mode, and the two control channels work independently without interfering with each other, working reliably and with strong anti-interference ability.
2.1 Main program flow chart
When the 1st control terminal is connected to the DC 24 V level, the timer starts timing. When it is disconnected, the timer stops timing, and the digital tube flashes to display the current timing prompt until the reset terminal is connected to the DC 24 V level, and the timer is reset and the timing is cleared. The two control terminals are independent. When the 1st control terminal starts timing, it can only be reset and cleared by the reset control of the 1st channel. When the 1st channel starts timing and is not reset, the 2nd channel starts timing and reset operations are invalid. The 2nd channel control is the same as the 1st channel. The main program flow chart is shown in Figure 6.
2.2 Display Module
The digital tube used in the display module is a 4-digit 7-segment dynamic display, and the decimal point moves automatically according to the timing range. When the timing data is greater than or equal to 0 and less than 10, the digit and 3 decimal places are displayed; when the timing data is greater than or equal to 10 and less than 100, two integers and two decimal places are displayed; when the timing data is greater than or equal to 100 and less than 1000, 3 integers and 1 decimal place are displayed; when the timing data is greater than or equal to 1000 and less than 10,000, four integers are displayed; when the timing data is greater than or equal to 10,000, the display resets from 0, but the accumulated timing inside the system is not cleared until it is manually reset.
2.3 Control Module
The control program uses the terminal level interrupt trigger method to control the start and stop of the timer.
2.4 Delay Module
3 Type test
On the basis of realizing the functions, the equipment was subjected to functional test, electromagnetic compatibility test and environmental test respectively.
3.1 Functional test
In the functional test, the equipment runs well and can well realize the designed functions. The timer has a timing range of 0.000 to 9999 s. When the timing reaches 9999 s, the timer restarts from 0.000, and the error is no more than 1 s after running for 30000 s.
3.2 Electromagnetic compatibility test
According to the provisions of TB3073-2003, the following tests were conducted in the electromagnetic compatibility experiment: electrostatic discharge immunity test, electrical fast transient pulse group immunity test, surge (impact) immunity test, power frequency magnetic field immunity test and pulse magnetic field immunity test. During the test, some problems were encountered and improvements were made in time.
3.2.1 Electrostatic discharge immunity test
When 8 kV air discharge interference was added to the power port terminal, the timer reset erroneously. After analysis, it should be a quality problem of the terminal. After replacing it with Taiwan Dingyang's terminal, the timer worked normally and no reset occurred under air discharge interference. The equipment worked normally. The equipment passed the electrostatic discharge immunity test level 3 class A.
3.2.2 Electrical fast transient burst immunity test
When +2 kV/5 kHz and -2 kV/5 kHz interference was added to the power line, the timer display flickered and could not count normally. It was observed that it was reset once every 300 ms. The electrical fast transient pulse group is composed of a continuous pulse train with an interval of 300 ms. After analysis, it was found that the interference directly affected the normal counting because the power supply did not have a protection circuit. After many tests and improvements, it was chosen to add a filter circuit as shown in Figure 7 to the power port, so that the equipment successfully passed the electrical fast transient pulse group immunity test level 3 Class A. During and after the test, the equipment worked normally.
3.2.3 Surge (impact) immunity test
When the power supply end was impacted, the CBB capacitor and diode at the power supply end were broken down, indicating that the protection circuit was not perfect enough and needed to be improved. After many tests and improvements, a TVS tube and a varistor were connected in parallel to the power supply port, so that the equipment passed the surge (impact) immunity test level 3 Class A. The selected filter circuit is shown in Figure 8. During and after the test, the equipment worked normally.
In addition, the timer successfully passed the Level 3 Class A power frequency magnetic field immunity test and the pulse magnetic field immunity test. During and after the interference test, the tested equipment was able to work normally.
3.3 High temperature test
During the 2-hour heating and keeping-warming process at +70℃, the timer can work normally. After the test, take out the sample from the test box and place it at room temperature for 2 hours, the timer can work normally.
3.4 Low temperature test
During the 2 h cooling and keeping warm process at -40℃, the timer can work normally. After the test, take out the test sample from the test box and place it at room temperature for 2 h, the timer can work normally.
3.5 Alternating damp heat
After the equipment has been subjected to 12 cycles of alternating damp heat (high temperature 40°C), the wet insulation resistance shall not be less than 1.5 mΩ.
① Wet insulation resistance: Test in the test chamber 2 hours before the end of the last cycle of alternating damp heat;
② Insulation withstand voltage: After the test, the test piece is taken out of the test box and placed at room temperature for 2 hours to recover, and then the insulation withstand voltage test is carried out. The voltage value during the retest is 75% of the original experimental value, which lasts for 1 minute. There is no breakdown or flashover during the test.
Conclusion
The digital timer uses PIC16F887 microcontroller, which is low-priced, highly reliable, low-power, and small in size. The display part uses an industrial-grade 4-digit 7-segment digital tube for dynamic display, which is stable. The input channel uses an optocoupler TLP521 for isolation, and the signal is transmitted in one direction. The input and output ends are completely electrically isolated, with strong anti-interference ability, high transmission efficiency, and long service life. The power module uses a voltage-stabilized isolation power module with a wide input voltage range and reliable and stable operation. The timer is small in size, accurate in timing, and high in precision. The timer has passed electromagnetic compatibility tests and environmental tests, can be used in complex environmental conditions, works reliably and stably, and has strong anti-interference ability.
Previous article:Design and implementation of intelligent room platform based on PIC32
Next article:Design of digital control constant current source system based on single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 18:07
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to determine which MSP430 is right for your LCD application
- 51 to 32 for beginners in embedded systems?
- C6000 DSP Work Summary
- Review summary: National Technology dual-core N32WB452 with CAN Bluetooth is here
- Moving bricks after work
- Caution! Don’t be fooled by long-term drift and hysteresis of voltage references
- Typical circuit of LM258 op amp
- [Lianshengde W801-KIT Experience] Unofficial debugger debugging experience
- 【Canaan K510】+Data acquisition and development environment construction
- When the company became the leader in microcontroller distribution, I was still doing the agency business.