基于单片机语音智能密码锁设计(编辑修改稿)内容摘要:
存密码 、并且通过 LCD 显示屏和 LED 灯直观地显示各密码锁各种状态,用继电器模拟锁的状态,用户可以自定义设置 6 位的数字密码,系统还具有报警功能,该系统基本 能够实现本文能够提出的功能和要求。 本设计也存在不足,缺陷一,单重的密码锁不能满足较高的安全需要。 缺陷二,该系统对电的依赖比较大,必须使 24C04 一直保持供电状态,当断电后不能正常工作。 缺点三,在按键按下时,按键声不够响亮清晰,在仿真时显得反映21 比较慢,假如能采用语音模块,能用语音播报按键时密码所处状态,密码锁将会更具人性化。 通过这次对智能密码锁的设计,感受更多的是自己的能力有限,知识不够丰富,知识点掌握的不够扎实,使得自己不能按自己初始设想完成自己的设计,使得所设的密码锁不够完整。 在这次设计中还让 ,让我了解了实时控制的原理,懂得怎样合理的使用芯片,发挥其功能。 体会到做设计时必须有条理的按一定步骤实行系统的设计、各个步骤的实施。 总之,这次课程设计使在电路设计方面受益匪浅。 参考文献 [1] 林立 .张俊亮 .曹旭东 .刘得军 .单片机原理及应用 : 基于 Proteus和 Keil C [M].北京:电子工业出版社 , 2020: 25. [2] 郑锋 .王巧芝 .李英建 .刘瑞国 .51单片机应用系统典型模块开发大全 [M].北京:中国铁道出版社 ,2020: 520. [3] 张俊谟 .单片机中级教程 [M].北京:北京航空 航天大学出版 ,2020: 3645. [4] 单片机高级语言 C51 Windows环境编程与应用 [M],电子工业出版社, 2020: 8695. [5] AT89C51 DATA SHEEP[M] .Philips Semiconductors,1999: 1536. [6] 康华光 .电子技术基础 (第 5版 )[M].北京:高等教育出版社 ,2020: 4548. [7] 彭华林等编 .数字电子技术 [M].长沙:湖南大学出版社 ,2020: 4560. [8] 金唯香等编 .电子测试技术 [M].长沙:湖南大学出版社 ,2020: 2630. 22 附件 AT24C04头文件 include define uchar unsigned char define uint unsigned int sbit SDA = P3^4。 sbit SCL = P3^3。 bit ack。 void delayNOP()。 void I2C_start()。 void I2C_stop()。 void I2C_init()。 void I2C_Ack()。 void I2C_NAck()。 uchar RecByte()。 uchar SendByte(uchar write_data)。 uchar read_nbyte (uchar SLA,uchar SUBA,uchar *pdat,uchar n)。 uchar write_nbyte(uchar SLA,uchar SUBA,uchar *pdat,uchar n)。 void delayNOP() { _nop_()。 _nop_()。 _nop_()。 _nop_()。 } void I2C_start() { SDA = 1。 SCL = 1。 delayNOP()。 SDA = 0。 23 delayNOP()。 SCL = 0。 } void I2C_stop() { SDA = 0。 SCL = 1。 delayNOP()。 SDA = 1。 delayNOP()。 SCL = 0。 } void I2C_init() { SCL = 0。 I2C_stop()。 } void I2C_Ack() { SDA = 0。 SCL = 1。 delayNOP()。 SCL = 0。 SDA = 1。 } void I2C_NAck() { SDA = 1。 SCL = 1。 delayNOP()。 24 SCL = 0。 SDA = 0。 } uchar RecByte() { uchar i,read_data。 read_data=0x00。 SDA=1。 for(i = 0。 i 8。 i++) { SCL = 1。 read_data = 1。 read_data |= SDA。 delayNOP()。 SCL = 0。 delayNOP()。 } SCL = 0。 delayNOP()。 return(read_data)。 } uchar SendByte(uchar write_data) { uchar i。 for(i = 0。 i 8。 i++) { SDA = (bit)(write_data amp。 0x80)。 _nop_()。 _nop_()。 25 SCL = 1。 delayNOP()。 SCL = 0。 write_data = 1。 } delayNOP()。 SDA = 1。 SCL = 1。 delayNOP()。 if(SDA==1) ack=0。 else ack=1。 SCL = 0。 delayNOP()。 return ack。 } uchar write_nbyte(uchar SLA,uchar SUBA,uchar *pdat,uchar n) { uchar s。 I2C_start()。 SendByte(SLA)。 if(ack==0) return(0)。 SendByte(SUBA)。 if(ack==0) return(0)。 for(s=0。 sn。 s++) { SendByte(*pdat)。 if(ack==0) return(0)。 pdat++。 26 } I2C_stop()。 return(1)。 } uchar read_nbyte (uchar SLA,uchar SUBA,uchar *pdat,uchar n) { uchar s。 I2C_start()。 SendByte(SLA)。 if(ack==0) return(0)。 SendByte(SUBA)。 if(ack==0) return(0)。 I2C_start()。 SendByte(SLA+1)。 if(ack==0) return(0)。 for(s=0。 sn。 s++) { *pdat=RecByte()。 I2C_Ack()。 pdat++。 } I2C_NAck()。 I2C_stop()。 return(1)。 } 1602头文件 include include define uchar unsigned char define uint unsigned int 27 sbit LCD_RS=P2^0。 sbit LCD_RW=P2^1。 sbit LCD_EN=P2^2。 void Delay_ms(uint xms)。 bit lcd_busy()。 void lcd_wcmd(uchar cmd)。 void lcd_wdat(uchar dat)。 void lcd_clr()。 void lcd_init()。 void Delay_ms(uint xms) { uint i,j。 for(i=xms。 i0。 i) for(j=110。 j0。 j)。 } bit lcd_busy() { bit result。 LCD_RS = 0。 LCD_RW = 1。 LCD_EN = 1。 _nop_()。 _nop_()。 _nop_()。 _nop_()。 result = (bit)(P0amp。 0x80)。 LCD_EN = 0。 return result。 28 } void lcd_wcmd(uchar cmd) { while(lcd_busy())。 LCD_RS = 0。 LCD_RW = 0。 LCD_EN = 0。 _nop_()。 _nop_()。 P0 = cmd。 _nop_()。 _nop_()。 _nop_()。 _nop_()。 LCD_EN = 1。 _nop_()。 _nop_()。 _nop_()。 _nop_()。 LCD_EN = 0。 } void lcd_wdat(uchar dat) { while(lcd_busy())。 LCD_RS = 1。 LCD_RW = 0。 LCD_EN = 0。 P0 = dat。 _nop_()。 29 _nop_()。 _nop_()。 _nop_()。 LCD_EN = 1。 _nop_()。 _nop_()。 _nop_()。 _nop_()。 LCD_EN = 0。 } void lcd_clr() { lcd_wcmd(0x01)。 Delay_ms(5)。 } void lcd_init() { Delay_ms(15)。 lcd_wcmd(0x38)。 Delay_ms(5)。 lcd_wcmd(0x38)。 Delay_ms(5)。 lcd_wcmd(0x38)。 Delay_ms(5)。 lcd_wcmd(0x0c)。 Delay_ms(5)。 lcd_wcmd(0x06)。 30 Delay_ms(5)。 lcd_wcmd(0x01)。 Delay_ms(5)。 } 设定初始密码程序 include include include define uchar unsigned char define uint unsigned int uchar code_buf[6]={1,2,3,4,5,6}。 uchar key。 uchar temp。 sbit BEEP=P3^7。 void beep() { BEEP=0。 Delay_ms(100)。 BEEP=1。 Delay_ms(100)。 } void MatrixKey() { P1=0xff。 P1=0xef。 temp=P1。 temp=temp amp。 0x0f。 if (temp!=0x0f) 31 { Delay_ms(10)。 temp=P1。 temp=temp amp。 0x0f。 if (temp!=0x0f) { temp=P1。 switch(temp) { case 0xee:key=0。 break。 case 0xed:key=1。 break。 case 0xeb:key=2。 break。 case 0xe7:key=3。 break。 } temp=P1。 beep()。 temp=temp amp。 0x0f。 while(temp!=0x0f) { temp=P1。 temp=temp amp。 0x0f。 } } } P1=0xff。 P1=0xdf。 temp=P1。 temp=temp amp。 0x0f。 if (temp!=0x0f) { 32 Delay_ms(10)。 temp=P1。 temp=temp amp。 0x0f。 if (temp!=0x0f) { temp=P1。 switch(temp) { case 0xde:key=4。 break。 case 0xdd:key=5。 break。 case 0xdb:key=6。 break。 case 0xd7:key=7。 break。 } temp=P1。 beep()。 temp=temp amp。 0x0f。 while(temp!=0x0f) {。基于单片机语音智能密码锁设计(编辑修改稿)
相关推荐
变频技术的 核心技术之一。 从最初采用模拟电路完成三角调制波和参考正弦波比较,产生 正弦脉宽调制 SPWM 信号以控制功率器件的开关开始,到目前采用全数字化方 案,完成优化的实时在线的 PWM 信号输出。 从 PWM 模式优化中得到了诸多的优 化模式,其中以鞍形波 PWM 模式效果最佳。 由于 PWM 可以同时实现变频变压反 抑制谐波的特点,由此在交流传动乃至其它能量变换系统中得到广泛应用。
1 kkkk =arctan() 同理 2020 年 拟合图如图 9所示 : 图 9 拟合可得 : z= + 倾 斜 (z轴与 xy 平面的夹角 ):对 z求一阶导 z39。 = +=tan( ) 7 7 0 . 9 6 7 7 0 . 9 8 771 7 7 1 . 0 2 7 7 1 . 0 4 7 7 1 . 0 6 7 7 1 . 0 8 7 7 1 .
为窗长至少应大于两个基音周期。 窗长应该选的更长一些,避免第一最大峰值点与基音周期不一致,窗长长了就可以更清楚的了解自相关函数的波形,更有利于检测。 计算起来不方便,近年来高速数字信号处理 器 (DSP)的使用,使让这一算法简单有效。 N 越小,误差越大,好处是运算时较简便。 所以要选择适当的 N 值。 用短时平均能量进行清 /浊音的判断 在基音检测的同时,应进行清 /浊音判断,因为可将浊音
占用大量的 I/O 口资源,因此在很多情况下都不采用这种方式,而是采用矩阵键盘的方案。 矩阵键盘采用四条 I/O 线作为行线,四条 I/O 线作为列线组成键盘,在行线和列线的每个交叉点上设置一个按键。 这样键盘上按键的个数就为 4 4个。 这种行列式键盘结构能有效地提高单片机系统中 I/O 口的利用率。 矩阵键盘的工作原理: 计算器的键盘布局如图 2所示:一般有 16个键组成
等待主机开始信号结束后 , DHT11发送响应信号 , 送出 40bit的数据 ,并触发一次信号采集 , 用户可选择读取部分数据。 从模式下 , DHT11接收到开始信号触发一次温湿度采集 , 如果没有接收到主机发送开始信号 , DHT11不会主动进行温湿度采集 , 采集数据后转换到低速模式。 ( 1) .通讯过程如图 28所示 图 28 通讯过程 13 操作时序如图 29,
/ R D17X T A L 218X T A L 119G N D20P 2. 021P 2. 122P 2. 223P 2. 324P 2. 425P 2. 526P 2. 627P 2. 728P S E N29A L E / P R O G30E A / V pp31P 0. 732P 0. 633P 0. 534P 0. 435P 0. 336P 0. 237P 0. 138P 0.