The residential security monitor designed in this paper is guided by the idea of hardware and software, giving full play to the functions of single-chip computer. Most of the functions are realized by software programming. The circuit is simple and clear, and the system stability is high. The functions of time, temperature, fire prevention and theft prevention, natural gas monitoring and password lock are realized. At the same time, the clock system has the characteristics of low power consumption, low cost, strong practicability, and the system has certain scalability.
The system is implemented by query mode, with display program and keyboard browsing program as the main program, and the rest, such as temperature, time adjustment, serial port sending, are called by subroutine.
This method can basically achieve the basic requirements of the experiment. It can achieve the functions of time display, temperature display, fire prevention and theft prevention, password unlocking, serial port sending and so on. And give an alarm unless the alarm event is lifted by itself or manually. When an event occurs, the LED digital tube displays the alarm information, which can be set as a subroutine. At the same time, the main program queries whether the event occurs, then calls the subroutine, and continues to query if it does not occur. The alarm is also set as a subroutine. The display subroutine should be called in the subroutine displaying the alarm information so that the display alarm information and the alarm occur simultaneously.
The password lock is also a query program. When entering the input password subroutine, the subroutine calls the key value query program. If the key value is the same as the setting value, the subroutine continues to query the next bit until all the queries are completed and the door opening program is started. Otherwise, it jumps out of the input password subroutine and enters the display alarm subroutine. When an alarm event occurs, the time, location and type of the event are transmitted to the monitor through the serial port. When the alarm occurs, the information is sent to the monitor, and the sending program can be made into a subroutine to determine whether to send by query.
Clock sender and location type sender are different. When sending, time content and location content should be invoked. When the alarm event is lifted, the time, location, type and mode of event lifting are transmitted to the monitor through the serial port. When there is no alarm, it can be used as a clock.
And it can display room temperature according to need. Watch display program as the main program, you can adjust the time program as a subroutine to call, display room temperature can also be achieved by query. This system uses STC89C52RC MCU as the main controller, supplemented by 74LS138 decoder, 74LS245 bus driver, temperature sensor DS18B20, matrix keyboard and LCD display circuit, realizes time and seconds display, real-time temperature display, manual adjustment settings of time and seconds parameters, anti-theft and fire alarm, and sends alarm.
Inter-location type. The system uses interrupt mode of MCU to timing, which can effectively reduce system errors, and then uses decoder for chip selection, saving the I/O port of MCU, and using matrix keyboard for function selection. The system has the characteristics of simple design, clear structure and friendly interface.
After testing, it can better realize the basic and expanded functions required by the title. There are many ways to drive LED digital tube with single chip computer.
According to display mode, there are static and dynamic display. According to decoding mode, it can be divided into hardware decoding and software decoding. Static display means that the display driver circuit has the function of output latch. The MCU will not take care of the data to be displayed until the next display data needs to be updated. The display data is stable and occupies little CPU time. Dynamic display requires CPU to refresh the display device at all times. The display data has a flickering sensation and takes up a lot of CPU time.
Hardware decoding means that the segment codes displayed are completely completed by hardware. The CPU only needs to send out standard BCD codes, and the hardware wiring has a certain standard. Software decoding is to use software to complete the function of hardware. The hardware is simple, the wiring is flexible, and the display code is completely processed by software. Because the hardware circuit of this design is relatively simple, the driver mode of dynamic display and software decoding is chosen. The dynamic scanning method is used to display the LED digital tube. The PI.0, P1.1, P1.2 of MCS-51 and the A, B and C of 74LS138 are connected with the cathode of 74LS245 to select the digital tube. The P0 port is connected with the anode of the digital tube through 74LS245, the P2 port is connected with the keyboard, and the sensor 18B 2 0 is connected with the P1.3 port to form the temperature control.
When the circuit board is powered on, the display time on the LED will be adjusted by KEY1, KEY2 and KEY3.
Press KEY4, LED display temperature, press KEY5 – KEY7, send relevant information to the monitoring window, KEY8, KEY9, as the upload key, and then press KEY1 – KEY7 to display and send anti-theft or fire related information. Turn on the dial switch 1, start the natural gas alarm program, and turn on the dial switch 2. Stop the anti-theft device (natural gas monitoring is normal), turn on the dial switch 3 and enter the infrared anti-theft system (this system is invalid when the dial switch 2 is turned on). Time, minutes and seconds are displayed separately by decimal points. Different glyph tables are used with and without punctuation, thermostatic element which makes it more convenient for people to read. The anti-theft and anti-fire procedure can be closed artificially. When someone is at home, the owner can choose to close the anti-theft and anti-fire monitoring, which avoids the false alarm caused by the owner.
This closure will not affect the natural gas monitoring. When the natural gas leaks, the alarm procedure will still start until the natural gas concentration is less than the rated value. By consulting the relevant security information, the window anti-theft system is set as double monitoring, one is broken glass monitoring, once the glass is broken, it will give an alarm; the other is infrared monitoring, if the glass is not broken, the alarm will occur if someone enters. This system adopts a program to prevent infrared error alarm. It can be automatically recognized when birds and flying insects occlude the infrared instrument and distinguish it from the intrusion of thieves. It is a truly usable alarm system.