System Design and Type Test of Single Chip Microcomputer Digital Timer

Publisher:zeta16Latest update time:2016-03-17 Source: 21icKeywords:PIC16F887 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
introduction

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.

a.jpg

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.

b.jpg

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.

c.jpg

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.

d.jpg

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.

e.jpg

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.

f.jpg

 

g.jpg

2.3 Control Module

The control program uses the terminal level interrupt trigger method to control the start and stop of the timer.

h.jpg
i.jpg

2.4 Delay Module

j.jpg

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.

k.jpg

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.

l.jpg

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.

Keywords:PIC16F887 Reference address:System Design and Type Test of Single Chip Microcomputer Digital Timer

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

MPLAB X IDE V4.2-2: How to use PIC10F200's TIMER0 timing
Since I have just come into contact with PIC microcontrollers, I need to study carefully. The delay method I use: The work requires PIC10F200 for timing: 1 Initially I used a simple delay() to implement However, this delay is not accurate, and because the crystal oscillator accuracy of each PIC10F200 chip is d
[Microcontroller]
MPLAB X IDE V4.2-2: How to use PIC10F200's TIMER0 timing
CC2530 bare metal programming series notes 3--Timer Timer1 free mode program
Timer 1 is a 16-bit timer with timer/counter/pulse width modulation functions. It has 3 individually programmable input capture/output comparison channels, each of which can be used as a PWM output or to capture the edge time of the input signal (for more information on what input capture/output comparison is and how
[Microcontroller]
STC15 series MCU timer components
/**  * File name: timer.h  */   #ifndef _TIMER_H #define _TIMER_H   #define SYS_MCLK 11059200 //System main clock #define FOSC 11059200 //Crystal oscillator frequency       #define USING_T0 #define USING_STC15_T2       #ifdef USING_T0 extern uint8_t tmr0LowByte, tmr0HighByte; void tmr0_init(uint8_t ms); #endif      
[Microcontroller]
【stm32f103】Use of TIMER basic timing function (register version)
1. TIMER STM32 Block Diagram As shown in the figure: 1 is the clock source ● Internal clock (CK_INT) ● External clock mode 1: external input pin (TIx) ● External clock mode 2: External trigger input (ETR) ● Internal trigger input (ITRx): Use one timer as the prescaler of another timer. For example, you can
[Microcontroller]
【stm32f103】Use of TIMER basic timing function (register version)
TIMER0 controls a single LED to flash
The program C language source code is as follows: /* INT1 interrupt 5-bit count */ #include reg51.h typedef unsigned char uint8; typedef unsigned int uint16; sbit LED = P0^0; uint16 T_Count = 0; void main() { TMOD = 0x01; TH0 = 0xFC; TL0 = 0x67; IE = 0x82; TR0 = 1; while(1); } void LED_Flash() interrupt 1
[Microcontroller]
TIMER0 controls a single LED to flash
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号