Apply AT89C2051-based decoder to security system

Publisher:创意旋律Latest update time:2006-09-29 Source: 单片机与嵌入式系统ic网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction
  At present, the most widely used codec in China is the PT2262 encoding chip with 531441 (3 12 ) states produced by Princeton Company and the matching PT2272 decoding chip. However, one PT2272 can only decode 15 states of PT2262 with one address. For larger codec security and anti-theft control systems, multiple PT2272 combination decoders are often used, but this is still far from meeting the design requirements of large and medium-sized security systems. . Therefore, the AT89C2051 microcontroller is used to realize the large-capacity decoding function of PT2262. 2 Coding principle of PT2262 The  working principle of PT2262 (please refer to http://www.princeton.com.tw) is shown in Figure 1. In the figure, K0~K7 are the address terminals, and their status should be preset; K8~K11 are data terminal, after pressing the button switches K8~K11, PT2262 will output a serial encoding pulse at pin 17. Switches K0~K11 are 12 bit code switches, and their status values ​​of 0 or 1 are combined to produce different coding results. Each time a set of codes is transmitted, four codes are automatically sent in succession. The 4M7 resistor is the external oscillation resistor of PT2262. MPSH10 is a 315MHz high-frequency oscillating triode. Figures 2 to 5 show the coding principle of PT2262. Figure 2 is the word code structure of PT2262, Figure 3 is the bit code signal of PT2262, Figure 4 is the synchronization bit signal of PT2262, and Figure 5 is the frame code structure of PT2262.  



  

3 Implementation of decoding 3.

Detection method of 1-bit encoded signal
  According to the encoding principle of PT2262, each 0-bit or 1-bit encoded signal output by it consists of two sets of pulses, so a microcontroller can be used for decoding. This design uses the AT89C51 microcontroller produced by ATMEL Semiconductor Company, uses "Timing/Counter 0" to time the pulse width, and determines whether the high byte of the pulse width is the same. If they are the same, it is the 0 or 1 bit of PT2262 (this design only Considered "0" and "1" states, the two sets of pulses for each bit are the same). AT89C51 must make 12 judgments on 0 or 1-bit encoding signals. If all are correct, the PT2262 encoder is one of the signals of this system. 3.2 SYNC synchronization signal detection method  The SYNC synchronization encoding signal of PT2262 is shown in Figure 4. The low level of this bit pulse is as long as 124 machine cycles, so it only needs to be judged whether its pulse width time is greater than 8 times the pulse width of the "0" bit or the "1" bit. 3.3 Processing of decoded signals  Compare the high 8 bits of the 12-bit decoded data (see http://www.princeton.com.tw) with the address data of the address code table in the E2 PROM . If they are the same, then Output the corresponding room number, unit number, building number and other data in the E 2 PROM to the 16-bit 7-segment display screen through the P0, P1, and P2 ports. 4 Hardware Circuit  The schematic diagram of the decoding and security alarm center circuit of this design is shown in Figure 6. The digital pulse signal processed by the high-frequency receiving module is sent to P3 of AT89C2051 (see http://www.atmel.com) .4 I/O port for decoding, and then output the data that meets the address code conditions in E 2 PROM to the computer through the RS232 interface. The numeric keyboard and alarm horn drive circuit parts are omitted in the figure.  



  



  



  

5 Software Design
  The software flow chart is shown in Figure 7. 5.1 Initialization Set the 16-bit timer/counter 0 of   AT89C2051 [1] to the internal counter mode. 5.2 Collection of coding signals  When the input signal is "1", the timer/counter 0 starts counting, and the high eight bits of the timer/counter 0 are stored in the memory buffer. When the input signal is "0", the timer/counter 0 also counts, and at the same time determines whether there is a value greater than 8 times the value in the memory buffer. If the conditions are not met, continue to collect pulse signals, otherwise the data in the 24 memory buffers will be processed.  



  



  


5.3 Processing of decoded signals
  
  Compare the data in the 24 memory buffers in pairs. If they are not equal, the encoded signal is not a signal in this system. If equal, set its value to "0" or "1". If the 12 sets of data are equal, you will get 8 "0" or "1" address bits and 4 "0" or "1" data bits. Compare
  
  the high 8-bit address bits with the data in the address code table in the E 2 PROM. If they are not equal, the encoding signal is not the control signal of the transmitter in this system. If they are equal, the corresponding room number, unit number, building number and other data in the E 2 PROM will be output to the 16-bit 7-segment display screen through the segment control port P0 and the bit control port P1 and P2, and the alarm horn will sound at the same time. The numeric keyboard is used to enter coded address, room number, unit number, building number and other data into E 2
  
PROM.   Assume that there are 32 types of PT2262 transmitters with addresses in a security and anti-theft system, and their addresses are 45H~64H. The value of the address code table is set in the AT89C2051 software to be 45H, 46H, 47H,..., 64H. If the K10 switch is pressed when the transmitter with address 50H, the value of the upper 8-bit address received by the decoding system is the same as the value of 50H in the address table in the software, then the corresponding 4-bit A, B, C, D will be output. The value is 0010B; if the transmitter with address 63H presses the K8 switch, the value of the upper 8-bit address received by the decoding system is the same as the value of 63H in the address table in the software, and the corresponding A, B, C are output , the value of D is 1000B;……. This design uses an AT89C2051 microcontroller to replace 32 PT2272 decoding chips.
  
  Therefore, in practical applications, the address value of PT2262 can be selected from any combination of 256 00H to FFH, thus realizing a large-capacity decoding function of 256 PT2262s and at least 256×4=1024 states. If K8, K9, K10 and K11 of PT2262 are combined in any way, there can be 256×15=3840 states.

6 Computer Data Processing [2]
  Delphi is a visual development tool launched by Borland. It provides a large number of components. Users can easily develop powerful applications, and the executable files compiled through it are quite efficient. high.   Establish a user database, including the user's anti-theft host number, name, detailed address, telephone number, mobile phone, paging and other information.   Use the SPCOMM serial port control to receive the serial port data sent by AT89C2051 - the number of the anti-theft host, compare the data one by one with all the anti-theft host numbers in the database, then display the user records with the same data on the screen, and call a sound to play at the same time Controls, alarm prompts. 7 Conclusion  This design scheme has been applied to the alarm center of the security anti-theft system and is running in good condition. It is also suitable for other encoding systems, such as VD5026 of Huazhi-Mosilicon Company and HT12A/12E, HT6012/6014/6016 of HOLTEK Company and other encoding chips.  

  

  



  

references

1 Zhang Yigang, wait. MCS-51 microcontroller application design. Harbin: Harbin Institute of Technology Press, 1990
2 Wu Xudong, et al. Delphi3.0/4.0 multimedia and database programming. Beijing: Tsinghua University Press, 2001
3 Translated by Wang Hui, et al. Delphi from entry to proficiency. Beijing: Electronic Industry Press, 2000

Reference address:Apply AT89C2051-based decoder to security system

Previous article:Research on the setting and application of 80C51 reset flag bit
Next article:Multi-channel data acquisition range control system based on C8051F000

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号