基于有线电话遥控电饭煲控制器设计毕业设计
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
(此文档为word格式,下载后您可任意编辑修改!)
基于有线电话遥控电饭煲
控制器设计
目录
摘要 (1)
Abstract (1)
前言 (1)
第1章总体方案设计..................................................... 错误!未定义书签。
1.1总体设计分析 ................................................... 错误!未定义书签。
1.2初略方案 ........................................................ 错误!未定义书签。
1.3单元电路方案拟定 ............................................... 错误!未定义书签。
1.3.1振铃检测电路方案 ....................................... 错误!未定义书签。
1.3.2模拟摘挂机电路方案 ..................................... 错误!未定义书签。
1.3.3DTMF解码电路方案......................................... 错误!未定义书签。
1.3.4语音提示电路方案........................................... 错误!未定义书签。
1.3.5电器控制电路方案 ...................................... 错误!未定义书签。
1.3.6开关状态显示电路方案 ................................... 错误!未定义书签。
1.3.7电源电路方案 ........................................... 错误!未定义书签。
1.4整体方案拟定 .................................................... 错误!未定义书签。
第2章硬件电路设计..................................................... 错误!未定义书签。
2.1单元电路设计 ................................................... 错误!未定义书签。
2.1.1振铃检测电路设计 ...................................... 错误!未定义书签。
2.1.2模拟摘挂机电路设计 .................................... 错误!未定义书签。
2.1.3DTMF解码电路设计......................................... 错误!未定义书签。
2.1.4语音提示电路设计 ...................................... 错误!未定义书签。
2.1.5电器控制电路设计 ...................................... 错误!未定义书签。
2.1.6开关状态显示电路设计 .................................. 错误!未定义书签。
2.1.7电源电路设计 .......................................... 错误!未定义书签。
2.2整体电路的调试................................................ 错误!未定义书签。
2.3整体电路工作过程 ............................................... 错误!未定义书签。
第3章程序设计......................................................... 错误!未定义书签。
3.1语音录放程序.................................................. 错误!未定义书签。
3.2主程序 ........................................................ 错误!未定义书签。
3.3DTMF解码数据读取程序........................................... 错误!未定义书签。
3.4振铃计数程序 .................................................... 错误!未定义书签。
3.5 超时检测程序.................................................. 错误!未定义书签。
3.6放音停止程序 ................................................... 错误!未定义书签。
第4章系统调试与分析 ................................................... 错误!未定义书签。
第5章设计成果......................................................... 错误!未定义书签。
5.1电路原理图 ..................................................... 错误!未定义书签。
5.2程序 ......................................................... 错误!未定义书签。
5.3使用说明 ...................................................... 错误!未定义书签。
5.4系统扩展....................................................... 错误!未定义书签。
第6章结论............................................................. 错误!未定义书签。
第7章总结与体会....................................................... 错误!未定义书签。
谢词................................................................... 错误!未定义书签。
参考文献............................................................... 错误!未定义书签。
附录.. (2)
附录1外文资料 (2)
附录2中文翻译 (9)
摘要
本设计是以STC89C52R为核心的电饭煲控制系统。
通过对电话网、DTMF言号、
语音提示、电器控制等的研究,实现了利用个人终端通信设备,对家用电器实施远程控制。
当达到
指定的振铃次数,系统会自动模拟摘机,之后通过不同的人性化语音提示,提示不同的操作以及
受控对象的状态,操作者根据自己的需求实行控制,此外,该系统还提供密码修改、重置功能。
在
安全方面,只有输入正确的密码才能控制家电,保证安全、可靠。
最重要的,在语音提示完毕后,
若在给定的时间内无操作,该系统会自动挂机,节约通信资源。
关键词:有线电话;远程控制;DTMF语音提示
Abstract
This design is a rice cooker control system which is based on STC89C52RC as the core.Through the research of the telephone network, DTMFsignals, voice prompt, electric control and so on , this design realize that using personal communications terminal equipment, we can realize the remote control of reaches the specified number of ringing, the system will automatically simulate off- through the different voice prompt, suggest different operations as well as the state of the controlled object,the operator control according to individual needs. moreover, the system also provides the function of the password modification, the password reset .On the security front, only can input the correct password to control addition, the most important is that after the voice prompt, if no operation in a given period of time, the system will automatically . Keywords: wire telephone ;remote control ;D T M F;voice prompt
、八、-
前言
时值信息时代,科学的进步和社会的飞速发展,推动了人类文明的进步。
自从贝尔发明电话
以来,已有100多年的历史。
这百年来,电话网络飞速发展,而我国近十多年在电话业务的快速
增长更是举世瞩目。
电话业务的飞速发展,使得有线电话步入千家万户,而现在的电话网已不仅仅
是用于传统意义上的接打电话,更用于网
络电话、宽带等其他业务。
电话网的发展,得益于科学的进步。
科学的进步给人们带来了极大的方便和享受,不仅仅是通讯设
备层出不穷,现代家用电器设备也是与日俱增。
追求高质量、高效率的人们在设想,有没有这样一套设备,即使出门在外也能控制家用电器、能够了解家里的情况,想想,下班的路上,给家里的控制器发个短信或是打个电话,就能控制热水器烧水,就能控制电饭煲煮饭,就能控制空调调节室温……而就在2008年
4月17 日举行的中国国际家电展上,海尔集团展出了自主研发的U-L. Fike, George E. Friend. Understanding Telephone Electronics. 4nd ed. Texas Instruments Inc. 2004.
[17] Bushby S T. A standard communication infrastructure for intelligent
附录
附录1 外文资料
Design of a Telephone Remote Controller
Guangli Long
School of Physics and telecommunication Engineering,Shaanxi University of Abstract
Electrical equipments are remote controlled through the telephone,a remote controller based on the fixed telephone line was designed by using MCU and DTMF decoder.The controller includes circuit,simulation of off-- program, countting the number of ringing program,DTMF decoding program,keyboard scanning program,voice program,EEPROM reading and writing program,displaying program,etc..The software programmed with C language, it is compiled on Keil C51 platform and produced the HEX file and downloaded to the MCU AT89S52.The the Proteus platform.The board of PCB is designedand manufactured,The MCU and other electronic components are welded on the PCB .It is connecting with the line of fixed telephone, when the telephone number was called,the electrical equipment may be controlled to turn on or
turn off,the password is showed on the LCD,the tip of voice is played.
Keywords: Telephone ,Controller, Electrical equipment,MCU
1.Introduction
With the development of economy and science technology, people's living standard is getting cooker, electric rice cooker,refrigerator, TV, computer etc.. Mostly manual or short distance remote control switch, not remotely close or open. When going out people may forget to turn off the lights, turn off the computer, Pull
plug electromagneticstove etc.. when think of it , people might far away from effectively solved this problem, it will appliances connected to the output end of the controller, the controller is connected to the telephone line, Electrical equipments are remote controlled by using the telephone line. when the telephone number was called,the electrical equipment may be controlled to turn on or turn off,the password is showed on the LCD,the tip of voice
is played.
2.Design of Figure 1, it consistsof the MCU minimum system, ringing detection circuit, simulation off- of the MCU minimum system
The minimum system of the MCU are composedof MCU AT89S52, clock circuit, reset circuit and the programming interface, Its main function is to control for each module. The reset circuit with manual reset and reset in two ways, the crystal is 11.0592MHz. In order to download the program to the MCU, the ISP programming interface which support the MCU AT89S52 is specially selected, the download circuit is designed according to the programming interface requirements. In order to make the programming interface can reuse and other device port, the download interface and matrix keyboard multiplexing approach is taken to IO port, not to press the keyboard when download, the download line is plugged after download, it will not the system.
2.2Design of the ringing detection circuit
The ringing detection circuit is designed as shown in Figure 2, the ringing signal is based on 48V DC voltage superimposed on the peak value of 90V25Hz sine wave signal, and the ringing signal every 4 secondsto send 1. Ringing detection circuit isolate the 90V sine wave signal, and converted to square wave signal which peak is 5V25Hz, This signal is sent to the MCU counting. By limiting step-down approach, the optocoupler is no output when the input is less than 50V , and obtained the positive the input is greater than 50V.Then LM339 is used to do the comparator which sine wave signal is converted to a standard square wave cycle, calculation of the ringing signal by MCU to determine whether the ringing signal 25Hz. The 27V zener diode is used for decompression in figure 2, in order to prevent the optocoupler current is too large to burn out. R12 is a current limiting resistor, when the ringing
signal arrived, the 25Hz the in-phase end of comparator, when the ringing signal does not come, the reverse input is 0,Vthen the output is the ringing signal arrives, through the optocoupler isolation, the reverse output is 5V25Hz the reverse voltage is more than
2.5V ,the output of comparator is 0V , the peak of 5V25Hz square wave signal is sent to the MCU counting.
Fig. 2 The ringing detection circuit
2.3 Design of analog off- of analog off- in figure
3. The circuit is mainly composed of a telephone line interface, a polarity switching circuit, isolation transformer, relay, optocoupler and triode. A telephone line interface use the standard RJ-11interface with two lines, and does not distinguish between positive and negative pole. The function of the polarity switching circuit is that the output is +- and regardless of the input is + - or -+ , it is using the design principle of the diode bridge rectifier circuit. The function of the Isolation transformer mainly is isolatting the phone line and the control system, and the use of the characteristics of DC resistance less than 300 ohm load, as used the load in the simulated off- whether to pick. The function of the optocoupler P521 is isolated the controlling power and relay power to prevent the relay switching interference affect the normal operation of the MCU system, and the triode is to drive the relay to work.
D6
Lin+ 哗
27V V' Lin ~~k~2
R12 VCC
l 戶21 4 y-k
UlOk —
11 OK
Fig.3 Analog off- of DTMF decoding circuit
Design of DTMF decoding circuit as shown in figure 4. MT8870 is a tone decoder chip which is made by MITEL company, it can be used to receive DTMF signal, inside the received signal into obtained the output through the Q1-Q4 conversion results in binary mode. The DTMF signal coupled to MT8870 by C2 and decoding. In the
absence of DTMF signal, STD is the DTMF signal detected, chip for decoding, and decoding is completed, the STD pull up, after inverting
Fig. 4 DTMF decoding circuit
the later changed into low level, when the MCU detected by , it will be the TOE pin to of voice recording circuit
Design of the voice recording circuit as shown in Figure 5, it is mainly composed of ISD1760, the MCU sends recording command to the voice chip through SPI simulation interface, the sound signal are converted to change electrical signals through a microphone (MIC1), it is coupling into the voice chip amplifying and sampling by C19 and C20, and finally stored in the internal ROM chip.The MCU send the play command to voice chip through simulation SPI interface, voice chip reads data from the specified address, and the readed data is converted into analog signal and output by SP+ through the DA. The speech signal is sampled by the internal ADC in voice recording circuit ISD1760 and converted to digital signal, the representation of speech signal data stored in internal ROM, the data is read from the internal ROM when playing , and these digital signal is converted to the speech signal through the DAC.
I
1N+
is-S'l t;T,
GS EST .
VREF STD
J Nil
PWL1N
OSCI◎
,
0S(2QI
VSS TOE
-O decoding output
CIlllQQn
SO 13
data nutpul
Q Output enable
.<1\D
氐57W1
DIME
signal
input
1L
Fig. 5 The voice recording circuit 2.6 The design of the power amplification circuit The audio signal from the ISD1760 output is power amplified by the audio power
amplifier, the power amplifier circuit is designed as shown in Figure 6, the amplifier gain is controlled by R 佃 and C5 series from minimum 20 to 200. LM386 is power amplifier,
driving the speaker voice, and the speech signal is coupled to the telephone line through the isolation transformer, so some voice prompt sound can be liquid crystal display circuit to display the necessarypassword prompt when changesthe password. 1, 2 pin of LCD1602 is power supply port. 15 and 16 pin is the backlight power and directly connected to the 5V power supply, the backlight always bright. 3 pin is connected to the dynamic contact of 10K potentiometer, it can make the 3 pin voltage continuously adjustable between 0-5V>o as to adjust the LCD1602 contrast. Other pins are data and controlling pins, they are connectedto the IO port of the MCU, it is controlled by the MCU . Independent keyboard adopt 4X 4 matrix, it is
used for password input. In order to enable password stored permanently, the EEPROM24C64 memory is selected to store passwords. The electrical equipments switch are controlled through the relay. All devices in the system are supplied by 5V
MCU
simulation oC
SP[ i tiler J K 4() 11W3
00K
HE T
RES PI. AY
LED ERAST~
rwn -
VCCB vun
VSSD FT
VCCA 盐 1SD176D VSSA SCIK vea 1 MOST
VSSP1 MISO
VSSF2 MFC+ SPf MFC- SV-
ANALA
ROSC ALD/AI X ACC INT /EB Y CT"i 0. luT 0 7 0. lul J fl I' KhiF
Audio output ffW ——vcc
k :用
ClKTl
H-
LI 3
2 J 17 27 8 14 16 12 26 出 !! 1 1 O luF
ROT <71——VCC
[A1386 Enable terminiilO ------- 1
Fig. 6 The power amplifier circuit
3. Design of software
The main title (on the first page) should begin 1 316 inches (7 picas) from the top edge of the page, centered, and in Times New Roman 13-point, boldface type. Capitalize the first letter of nouns, pronouns, verbs, adjectives, and adverbs; do not capitalize
articles, coordinate conjunctions, or prepositions (unless the title begins with such a word). Please initially capitalize only the first word in other titles, including
sectiontitles and first, second,and third-order these guidelines). Leave two blank lines after the title. The software consists of main program,ringing detection and countting program, DTMF decoding processingprogram, keyboard scanning procedures,voice controlling procedures, EEPROM reading and writting procedures, LCD display subroutine,etc.. 3.1 Design of the main program
The flow chart of the main program is designed as shown in figure7. It mainly
includes: initialization, off-, key detection, password verification ,etc.. The main procedure is to control the scheduling of each module, the initialization operation of each module is completed, and keyboard scanning and off-.
The audio u 1 signal 血的钿
]NPIT+
I 声
rll
220uP16V + r
Sfi/O.SW
R21
12k L7
I —^1
o <
◎
Wait for the 5 password input
I^otnpi for password updated successfully
LC D back to the main inter face
Fig.7 The flow chart of the main program
3.2 Design of ringing detection and simulated off- circuitis connectedwith the MCU through the external interrupt 1, when ringing signal arrives, ringing detection circuit will output 25Hz5V square wave signal, it will trigger external interrupt 1 and execute the interrupt program in every drop of a square wave cycle . Because the ring is 1s on and 4s off, the signal of 25Hz can be counted when the ringing signal arrivving, the ringing is 4 times when the count reaches 80. The timer 0 is closed before the first interrupt
arrivalling, the program starts the timer counting, when the secondand subsequentinterrupt arrivving, the value of timer 0 is judged by the MCU whether two interrupt interval is 40ms (25Hz). If it is that the ringing signal plus 1 and judged whether the ringing signal is greater than 80, more than 80 offend. 3.3 Design of the DTMF decoding program
A falling edge When the MT8870 decoding completed is triggered external interrupt 0 to enter the interrupt processingprogram, it include three processing program modes: normal mode, the password input mode and electrical equipment controlling mode. Normal mode do nothing, the password input mode converts the DTMF signal into a password and sent to the main program to determine whether the password is correct . And electrical equipment controlling mode control different appliance switch and on- the three modes is composedof main program . A global variable is defined, the value of the variable is modified by the main program , it makes the DTMF interrupt program determine in different work mode according to
The 、oice prompt to enter the passu ord Wmt fbr lnpul 曲呂 5 password
Benni
Flay voice
*
on-
hook.
tey deicc(klS>*—
The voice prompt how to control appliances 1 门I 。
ihc clcciric
nuHte
LCD prompted to enter a new password
coireci?
Jniualized
leciiori
* N
ic pass^ o Gets the key values
the value of the variable .In addition, in order to prevent users from without the exit button after operation finished, the system cannot automatically the counter is greater than 130 (about 10s), while in normal operation, it will be the timeout value reset in the DTMF decoding interrupt when the user pressesa key. With the C language programming, the program
is compile and modified on the platform of Keil4,. Proteus platform, succeed PCB board is designed and manufactured, the MCU which downloaded the program and other components are welded on the PCB board, function is testing. The first simulation off- both sides is 50V, the analog control IO off- both sides is about 7V when LED indicator lights. Electrical drive circuit is tested, relays and the release is measured with a multimeter to determine the switching on and off. Testing procedures are written for the DTMF decoding circuit , and it
is tested with LCD1602. Voice recording circuit is controlled with SPI mode, the address of recording program is started until the end address after electrified, speech is automatic recorded playback after the completion of recorded. Each module test normal debugging, telephone number which connected the controller is called, it can control the electric equipments opening and closing, liquid crystal displaying code, voice prompting.
5. Conclusion
The remote controller based on telephone line , appliance controlling, voice prompting, automatic on- also be extended alarm clock, calendar and other functions. 附录2中文翻译
电话远程遥控器设计
龙光利
物理与电信工程学院,陕西工业大学
摘要
基于固定电话线路设计的远程控制器利用了单片机和DTMF军码,对电气设备进
行远程控制。
控制器包括硬件和软件,硬件由单片机最小系统、振铃检测电路、模拟摘挂机电路、电气设备驱动电路、DTMF军码、液晶、键盘和EEPRO等;软件由主
程序、振铃计数程序、DTMF军码程序、键盘扫描程序、语音程序、EEPRO读写程序、显示程序等。
编程使用C语言,利用Keil C51平台编译,生成十六进制文件并下载到单片机AT89S52中。
硬件电路在proteus平台上仿真。
PCB设计和制造出来,单片机和其他电子元器件焊接在PCE上。
把
控制器连接到固定电话线路上,当拨打电话号码时,电气设备就能被控制打开或关掉,而密码在液晶屏上显示,语音提示会播放,提示操作。
关键词:电话、控制器、电气设备、单片机
1.介绍
随着经济和科学技术的发展,人们的生活水平越来越高,电气设备也越来越多,如电磁炉、电
饭煲、冰箱、电视、电脑等。
一般短距离遥控开关,不能远程控制关闭或打开。
当外出时,人们可能忘了关灯,关掉电脑,拔电磁炉灶的插头等。
当想起时,人们可能已经出远门了。
电话远程控制器可以有效地解决这一问题,将电气设备连接到控制器的输出端,控制器连接到电话线上,利用电话线路远程控制电气设备。
当拨打电话号码时,电气设备就能被控制打开或关掉,而密码在液晶屏上显示,语音提示会播放,提示操作。
2.硬件的设计
电话远程控制器的框图如图1所示。
它由单片机最小系统、振铃检测电路、模拟摘机电路、DTM解码电路、录音电路、显示电路、键盘矩阵、存储单元和电气设备驱动电路等。
曲功率控制电气设备1 电气设备2 电气设备3
图1电话远程控制器框图
2.1单片机最小系统的设计
单片机的最小系统由单片机AT89S52时钟电路、复位电路和编程接口组成,用于控制各个外围模块。
复位电路有手动复位和自动复位电路复位两种方式,晶振用的是11.0592 MHz为了下载程序到单片机,单片机AT89S52的ISP编程接口是特殊的10,下载电路根据编程接口需求而设计。
为了使编程接口可以和其他设备端口重
用,下载接口和矩阵键盘共用10端口,不按按键盘时下载。
下载线是插在下载接口 中的,它对系统没有任何影响。
2.2振铃检测电路的设计
振铃检测电路设计如图2所示,振铃信号是基于48v 直流电压叠加的峰值为 90v25hz 的正弦波信号,振铃信号断4秒送1秒。
振铃检测电路隔离90v 正弦波信号, 并转换为方波信号峰值5v25Hz,这个信号送到单片机计数。
通过限制降压的方法, 当输入小于50v 时,光耦合器没有输出,当输入大于 50v ,就获得正弦波信号的正半 周,然后LM339比较器将正弦波信号转换成一个标准的方波,通过单片机对25Hz 的 振铃信号计数,其中27v 稳压二极管用于减压。
在图2中,当振铃信号到达时,通过 光耦合器输出25Hz 半波正弦信号,为了防止光耦合器电流过大烧坏, R12起到限流 的作用。
通过两个电阻分压获得 2.5v 给比较器的同相端,振铃信号不来的时候,反向 输入为0v,输出高电平;振铃信号到来时,通过光耦合器隔离,反向输出5v25Hz 半正 弦波,当反向电压2.5V 以上,比较器的输出是0v,最后,5v25Hz 的方波信号发送给 单片机计数。
图2振铃检测电路
2.3模拟摘机和电话接口电路的设计
模拟摘机和电话接口电路的设计如图
3所示,电路主要由一个电话线接口 ,一个
极性转换电路、隔离变压器、继电器、光耦合器和三极管。
电话线接口使用的是标 准的双线RJ-
11,并且不区分正负极。
极性转换电路的功能是不管输入是 +-还是-+,
输出都为+-,这是利用了二极管桥式整流电路的设计原理。
隔离变压器的功能主要是 隔离电话线和控制系统,而接入直流电阻小于 300欧姆负载,就能实现模拟摘机。
通过单片机控制继电器,双掷开关来选择是否摘机。
光耦合器 P521的功能是隔离控 制电源和继电器电源,防止继电器开关干扰单片机系统的正常运行 ,而三极管用于驱 动继电器工作。
D6 Lin+ og-
27V
10K VCC
1P52L4
Li,rc
s 9
R16 I ok C J D
VCC
10K 列——振铃
2.4 DTMF 解码电路的设计
DTMF 军码电路设计如图4所示。
MT8870解码器芯片,是由MITEL 公司生产的,它 可以用来接
收DTM 信号,接收到的信号经过高频带和低频带,并通过内部数字解码解 出键值,然后以二进制模式通过 Q1-Q4输出结果。
DTMF 言号通过C2耦合到MT8870并 解码。
在无DTMF 言号时,STD 保持低电平,通过取反器反相输出高电平,取反器由 Q1,R6和R1组成。
当DTMF 言号检测到、解码芯片开始解码,完成解码后,STD 拉高, 反相后变成低电平,当单片机检测到下降沿,它将TOE 置高允许输出,Q1-Q4数据读入 单片机处理,DTMF
军码完成。
图4 DTMF 解码电路
2.5录音电路的设计
录音电路的设计如图5所示,主要用的是ISD1760,单片机通过模拟SPI 接口发送 录音命令来录入声音。
通过麦克风(MIC1),声音信号转换为电信号,并通过C19和C20 取样,耦合到语音放大芯片输入端,最后存储在语音芯片内部 RO 加。
单片机通过模 拟SPI 接口发送放音命令来录入声音,语音芯片从指定地址读取数据
,通过DA 转化
为模拟信号通过SP+俞出,由ISD1760内部ADC 采样的录音电路将语音转换成数字信 号,存储在内部ROM 从内部ROM 读取数据时,这些数字信号通过DAC 专换为语音信号。
R1 10K
o 解码输岀
DTMF
倍号输入
100k
H Q H :k 579M
1\+
VDU l\-
ST/GT CS EST YRI7 Sil) IX1I M1B87O Q4 pwm Q3 OSC1
Q2
Ql vss TOE
Cl lOOn
||,GND
Ql
KE —dE__
:
解码数据输出
*■ J
Q 输出使能
VCC I
心 J
18
11 16 15 11
13 I 心 5. 1211 m
2.6功率放大电路的设计
ISD1760输出的音频信号经过音频功率放大器放大,功率放大器电路设计如图6 所示,放
大器增益由R19和C5控制,增益从20至200。
LM386功率放大器用于驱动 扬声器发出声音,语音信号是通过隔离变压器耦合到电话线,这样,远程用户就能听 到语音提示。
23
25
22
7
■ ---
---------
5
-----------
4 -------- --
4
RES
1上])
EPASE
冉D
VCCD VOL VSSD
FT
Vl ;CA ISI)I7K
[J VSSA
SCIK
VCCP
VSSPI MtS() VSSP2
M[C+
SP^ MIC- SP-
WA
ROSC AUD/AUX AGC
IM/RDY
CL T ||O. luF
C17 A 山
21
I-
R32 HWI ------ VCC
vcc
R36
HR7I
|h
图5录音电路
单片机伪童
19
10 i 1
Jt
JII
7K Li
3
a
15 _l b 2
C1K (L
luE
仏1
C20
+ C21
luF
Cl 00
图6功率放大电路
2.7显示、输入、存储、驱动器和电源电路
在密码更改时,LCD1602液晶显示电路用于显示必要的密码提示。
LCD1602的1、
2脚为电源端口,15和16脚是背光电源,直接连接到5 v 电源,背光灯常亮。
3脚连 接到10k
电位器,通过它可以使3脚的电压在0-5V 之间连续可调,以调整LCD1602的 对比度。
其他引脚是数据端和控制端,它们连接到单片机的10端口,由单片机控制。
独立键盘采用4X 4矩阵,用于输入密码。
为了使密码永久保存,选择EEPROM 24C64 内存来存储密码。
电气设备开关通过继电器控制。
系统的所有设备提供的
5 v 。
3 .软件的设计
软件由主程序、振铃检测和计数,DTMF 解码处理程序,键盘扫描程序,语音控制程 序、
EEPROI 和写作程序,液晶显示子程序等。
3.1主程序的设计
主程序的流程图设计如图7所示,它主要包括:初始化、摘机检测,键盘检测、 密码验证等。
主程序用于控制调度各个模块程序 ,初始化各个模块,键盘扫描和摘机 检测。
初始化
VC C
一
G\T) ,|
C5suf'^v
(■
17
音频信号10uf716V 9
INPIT-
IMYT-
二C 吃
[R21
104
T
12k
LM3场使能端O ----- 匸[E*垃
1()
v(}
LCD提示输入新密码
等待输入半位密^ |
提示巒码旻新成功]
' 遼回至程序接口
------------------------ 1…
图7主程序流程图
3.2设计振铃检测、模拟摘机程序
单片机通过外部中断1对振铃进行检测。
振铃信号到来时,振铃检测电路将输出
5V25HZ的方波信号,在每一个下降沿,它将触发外部中断1并执行中断程序。
因为振铃1 s,停止4 s,25Hz的振铃信号到来时,开始计数,4次振铃计数将达到80。
在第一次振铃到来前,定时器0关闭,当振铃到来,程序启动定时器计数,当第二个和随后的中断到来,由单片机定时器0的值来判断两个中断时间间隔是否为40 ms(25 hz),如果是,振铃信号加1,同时判断振铃信号是否大于80,如果是,就摘机,否则结束。
3.3设计的DTMF军码程序MT8870解码完成时,一个下降沿触发外部中断0进入中断处理程序,它包括三个处理程序模式:正常模式,密码输入模式和电气设备控制模式。
正常模式什么也不做,密码输入模式将DTMF言号转换成一个密码,发送到主程序,以确定密码是否正确。
电气设备控制模式根据DTMF言号解码值控制不同设备开关和挂机。
三种模式之间的切换由主程序定义的一个全局变量进行切换,根据该变量的值,DTMF中断程序确定其工作模式。
此外, 为了防止按钮操作完成后用户没有退出, 系统不能自动挂断, 定时器0 中断用于超时计数器, 计数器大于130(约10 分)时系统自动挂断。
当用户按下一个键,超时值将重置。
程序采用C语言编程,程序编译和修改在Keil4平台上完成,编译成功后生成hex 文件,再下载到单片机AT89S52中。
4.实验结果
所有电路单元都是在Proteus平台上模拟的,PCB板设计和制造完成后,单片机和其他元件焊接到PCB板上,下载程序,进行功能测试。
首先测试模拟摘机电路,将它连接到电话线上,模拟摘机继电器没有吸合, 测量电话线路两侧50v,模拟控制10摘机连接到地,两侧电压为7v,LED旨示灯亮。
测试电器驱动电路、用万用表测量来确定继电器开关状态。
DTMF军码电路的测试,是基于LCD1602测试的。
录音控制电路是基于SPI 模式的, 从起始地址开始录音,直到录到最后, 录音完成后自动播放。
每个模块调试测试正常后,将控制器连在电话线上,拨打电话, 它可以控制打开和关闭电气设备, 液晶显示及语音提示。
5.结论
基于电话线的远程控制器具有呼叫等待, 密码身份验证、设备控制、语音提示, 自动挂机, 密码修改并永久存储等功能。
控制器添加了密码更改, 语音提示, 液晶显示功能, 也可以扩展闹钟, 日历及其它功能。