摘 要
本文主要探讨了与人们日常生活联系密切的智能小区安防系统的设计问题,设计具有防盗,防火和防煤气泄露功能的智能小区安防报警系统。系统的结构由三部分组成:报警传感器、单片机控制器、监控中心组成。本系统采用了体积小巧,功能强大,价格便宜的单片微型计算机AT89C51作为小区住户家庭的第一监视端,与单片机相连接的各种用于家庭安保的传感器用于家庭报警,收集各种报警信号,并送单片机进行初步处理,单片机实时与远方监控中心通信,通过CAN总线将传感器感受的信号传给主机,这样,监控中心就可以清楚的知道小区住户家里的异常情况,以便及时的进行处理。该系统由于使用方便,价格合理,在实际的工程中,有广泛的应用,因而,具有良好的应用前景和推广价值。
该智能小区安防系统运用了AT89C51单片机、四种报警传感器、模数转换ADC0809、CAN总线控制器SJA1000和CAN总线收发器PCA82C250。本系统充分的将主从式微机通信运用于今天的生活,体现了自动化的发展前景一片光明。
关键词:小区安防;AT89C51;传感器;信号处理;报警器;CAN总线
Abstract
This paper mostly describes how to design the guard system of uptown.The guard system provides many functions, such as guard against fire、gas leaking out and so on, realizing the automatization of the public security of updown. This security alarm system structure is composed by three parts:the scenec controls measure,the family control measure, and monitoring center. Alarm system of updown is made up of clients and warning center. Use the chip of CAN to form the alarm network of uptown, and the software to carry out communication between clients and warning center. In the PC on board management report to the police signal analysis, showed warn information, convenient for and small area security personnel in time help handle excrescent affairs, and convenient to residents uptown. This system uses the CAN network to deliver the message, and improve the reliability, with more convenient operation, and used extensively in actual engineering, So it has a good applied foreground and extend value in engineering.
This system introduces the main characteristic and principle of Singlechip AT89C51、several sensors、SJA1000、PCA82C250,using ADC0809 to collect datas, and then the expatiation on communication between principal and subordinate, and applicate this method to the control of MCS-51 series single-chip microcomputer.
Keywords: Singlechip communication;AT89C51;Sensor; Signal processing;Alarm;CAN network
目 录
引言...........................................................1
1 总体设计....................................................2
1.1 设计背景..............................................................2
1.2 设计思想..............................................................2
1.3 系统功能..............................................................3
1.4 系统设计框图.........................................................4
1.5 系统实现方法..........................................................4
2 系统可行性分析..............................................5
2.1 硬件模块..............................................................5
2.1.1单片机控制模块.......................................................5
2.1.2温度烟雾信号采集模块.................................................7
2.1.3煤气信号采集模块.....................................................7
2.1.4防盗报警模块.........................................................7
2.1.5光报警模块...........................................................7
2.1.6数据采集模块.........................................................8
2.1.7键盘显示模块........................................................11
2.1.8CAN总线协议.........................................................11
2.1.9传感器模块..........................................................13
2.2 软件模块.............................................................14
2.2.1温度烟雾信号采集模块................................................14
2.2.2煤气信号采集模块....................................................15
2.2.3防盗报警信号采集模块................................................15
2.2.4光报警..............................................................15
2.2.5信号采集模块........................................................15
2.2.6键盘显示模块........................................................15
2.2.7CAN总线通讯模块.....................................................16
3 硬件单元电路设计...........................................17
3.1 ADC0809和三个报警传感器的接口电路....................................17
3.2 AT89C51与ADC0809接口电路.............................................17
3.3 AT89C51与光报警接口电路..............................................18
3.4 键盘显示接口电路.....................................................19
3.5 AT89C51与CAN总线借口电路.............................................19
4 软件设计...................................................21
4.1 CAN总线程序..........................................................21
4.1.1CAN初始化...........................................................21
4.1.2CAN数据发送.........................................................23
4.1.3CAN接收数据.........................................................24
4.2 温度传感器18B20......................................................25
4.3 ADC0809转换..........................................................25
4.4 数字显示.............................................................30
5 系统可靠性设计.............................................33
5.1 系统抗干扰性设计.....................................................33
5.1.1硬件抗干扰措施......................................................33
5.1.2软件抗干扰措施......................................................33
5.2 提高元器件的可靠性...................................................34
5.3 容错技术.............................................................34
6 系统调试...................................................35
6.1 整体调试分析.........................................................35
6.2 硬件单元电路调试.....................................................35
6.2.1最小系统板调试......................................................35
6.2.2A/D转换电路调试.....................................................35
6.2.3光报警电路调试......................................................36
6.2.4键盘显示电路调试....................................................36
6.2.5传感器电路调试......................................................37
6.3 软件程序调试.........................................................37
6.3.1软件系统设置........................................................37
6.3.2单片机系统软件调试..................................................37
6.3.3CAN总线软件调试.....................................................38
6.3.418B20
6.4 调试过程中发现的问题及解决方法.......................................38
6.5 联机调试.............................................................38
7 系统使用说明...............................................40
8 结论.......................................................41
谢词..........................................................42
参考文献......................................................43
附录..........................................................44