基于单片机的单词记忆测试器毕业设计
基于单片机的计算器设计毕业设计+外文文献翻译

摘要计算器一般是指“电子计算器”,能进行数学运算的手持机器,拥有集成电路芯片,结构简单,功能较弱,但由于它使用方便、操作简单、价格低廉,因而广泛运用于商业交易中,也是必备的办公用品。
近年来随着科技的飞速发展,单片机的应用正在不断深入,同时带动传统控制检测技术日益更新。
在实时检测和自动控制的单片机应用系统中,单片机往往作为一个核心部件来使用,但仅单片机方面的知识是不够的,还应根据具体硬件结构、软硬件结合,来加以完善。
因此,单片机的应用已经越来越贴近生活,用单片机来实现一些电子设计也变得容易起来。
计算器在人们的日常中是比较的常见的电子产品之一。
可是它还在发展之中,以后必将出现功能更加强大的计算器,基于这样的理念,本次设计是用单片机来设计的计算器。
该设计系统是以AT89S52 为单片机,P1 口作为输入端,外接4X4 的键盘。
通过键盘扫描来对输入数的控制,在P0 口、P2 口接了驱动电路,用来保证LCD 的工作正常。
计算器将完成的功能有加,减,乘,除等功能。
关键词:计算器;单片机;LCD;矩阵键盘ABSTRACTCalculator generally refers to the electronic calculator, and the term is introduced to China by the Japanese. The calculator with the IC chip, simple structure, and weak function is able to perform mathematical operations on handheld machine. But it is easy using, simple operation and low price. So it is widely used in commercial transactions, and is also an essential office supplies.With the rapid development of science and technology in recent years, the application of SCM is the deepening and promote the traditional controlling detection technologies that are increasingly updated. In real-time detection and automatic control of microcomputer application system, the microcontroller is often used as a core component to use, but only the knowledge of the microcontroller is not enough, and should be based on the specific hardware architecture, hardware and software combination to make it perfect. So the application of SCM is more and more close to life, so using of single chip to achieve some electronic designs also become easy. In the people daily life the calculator is one of the common electronic products. But it is still in development, it will become more powerful calculator in the future. According to such idea, the design is that SCM design calculator. The design system is based on AT89S52 microcontroller, P0 port as input, external 4X4 keyboard. In P1, P2mouth is connected with the drive circuit to ensure the normal work of LED. The calculator will complete add, subtract, multiply, divide and other function.Keywords: calculator, MCU, LCD, Matrix keyboard前言计算器(calculator;counter)一般是指“电子计算器”,能进行数学运算的手持机器,拥有集成电路芯片,结构简单,功能较弱,但由于它使用方便、操作简单、价格低廉,因而广泛运用于商业交易中,也是必备的办公用品之一。
基于单片机的单词记忆器设计

基于单片机的单词记忆器设计单片机单词记忆器设计可以通过以下步骤实现:1. 硬件设计:选择适合的单片机开发板或芯片,例如Arduino、Raspberry Pi等。
根据需求,设计并连接合适的输入和输出设备,如按钮、显示屏和喇叭等。
2. 单词库准备:将需要记忆的单词以文本文件的形式存储在单片机的存储器中,可以使用SD卡、SPI Flash或EEPROM等。
3.用户界面设计:使用按钮和显示屏实现用户与记忆器的交互界面。
例如,通过按下按钮来选择单词,并在显示屏上显示相应的单词和释义等信息。
4.单词显示和播放:根据用户选择的单词,在显示屏上显示该单词的释义,并通过喇叭或耳机输出单词的发音。
可以使用相应的语音合成库或芯片实现发音功能。
5.记忆训练模式:设计相应的记忆训练模式,例如根据顺序或随机选择单词进行测试和复习。
可以通过按下不同的按钮或在界面上选择相应的模式。
6.学习记录和进度统计:设计记忆器可以记录用户的学习历史和进度,例如已经学习的单词数量、学习时间等信息。
可以通过单片机的存储器或在外部存储设备中保存这些信息。
7.能源管理:考虑使用低功耗设计,例如增加电源管理模块,以延长记忆器的电池寿命。
添加睡眠模式,当记忆器长时间不使用时,自动进入低功耗状态。
8.软件运行控制:根据硬件设计、用户界面和功能要求,编写相应的单片机代码。
包括读取单词库文件、界面交互、单词显示和发音等功能的实现。
9.调试和测试:将代码烧录到单片机上,并通过调试和测试验证各个功能的正确性和稳定性。
根据测试结果进行适当的优化和改进。
最后,对于特定需求和设计约束,可能需要根据实际情况进行适当的调整和修改。
单词记忆测试器

单词记忆测试器Document serial number【UU89WT-UU98YT-UU8CB-UUUT-UUT108】摘要随着现代社会的发展,电子技术的进步我们有目共睹,计算机是现代电子技术的成果。
在现实生活中、科学研究中计算机起着越来越重要的作用。
微型计算机原理这门课程是对计算机进一步的了解与接触,微型计算机原理是一门培养计算机应用能力的技术基础课程。
本课程主要介绍了有关微型计算机的硬件基础知识、基本原理,掌握汇编语言的指令以及编程应用。
本课程设计是基于微机原理与接口技术的简单应用。
本设计以8086cpu为处理器,利用8255处理芯片的复位功能来实现对于单词的录入,读取。
以12854点阵液晶屏为显示器件,并使用5×6距阵键盘为输入设备,实现了功能全面的人机界面和高速的数据处理功能,,可储存10-20个英文单词,作为记忆测试用。
关键词:8086cpu;8255处理芯片;12854点阵液晶屏 5*6矩阵键盘目录1绪论 (1)基本内容 (1)用途及特点 (1)2方案选择及论证 (2)设计方案 (2) (2) (2)方案论证 (2)3硬件系统说明 (4)硬件设计思路 (4)中央处理模块 (4)显示模块的硬件部分介绍 (4)矩阵键盘 (7)系统构成框图 (8)芯片选择 (9)8086CPU内部结构及其各引脚 (9)8255A处理芯片 (10)电路原理图设计 (13)存储空间与I/O地址分配 (14)4 软件系统说明 (15)软件设计思路 (15) (15) (16) (18)矩阵键盘输入模块 (19)LCD12864显示模块 (19)显示字模码的提取模块 (20)源程序清单 (20)5所选芯片清单 (28)总结 (29)致谢 (30)参考文献 (31)1绪论随着现代社会的发展,电子技术的进步我们有目共睹,计算机是现代电子技术的成果。
在现实生活中、科学研究中计算机起着越来越重要的作用。
多媒体技术、网络技术、智能信息处理技术、自适用控制技术、数据挖掘与处理技术等都离不开计算机。
单片机数码管记忆系统实验报告

单⽚机数码管记忆系统实验报告电⼦信息⼯程专业单⽚机原理及应⽤课程设计班级电⼦信息⼯程学号0000000000姓名xxxxx指导教师xxxxxxxx⽇期00000000⼀、题⽬基于AT24C02的数码管显⽰记忆系统⼆、设计内容1、内容设计⼀个基于A T24C02芯⽚的单⽚机数码管显⽰记忆系统。
数码管和两个74HC573芯⽚进⾏连接,P2.6和P2.7管脚分别控制这两个573芯⽚;P2.0和P2.1管脚连接AT24C02芯⽚的SCL和SDA管脚,使⽤C51语⾔设计程序,当系统上电后,数码管从000~255每隔1s⼀次显⽰计数,当计数到255后,则从000重新显⽰计数,并且在系统断电后再次上电时,数码管依旧按断电前的数字继续进⾏计数,不会丢失数据,数字显⽰在X6~X8数码管上。
2、元件清单列表序号标号器件名称型号数量1 R1 电阻10K 112 C1.C2. 电容1nf 23 C3 电解电容1nf 14 XTAL 晶振12MHz 15 Switch 开关 26 U4 单⽚机89c52 17 U8、U12 芯⽚74HC573 28 U7 芯⽚A T24C02 19 LED 数码管4393H 2三、软件设计1、流程图否是是是否开始系统初始化按键是否按下按下按键计数器依次加⼀是否关闭电源记忆当前的数据值计数器继续依次加⼀判断计数器的值是否达到255计数器清零2、代码#include //包含头⽂件#define unint unsigned int //定义数据类型#define uchar unsigned charsbit SDA=P2^0; //定义SDAsbit SCL=P2^1; //定义SCLsbit WEI=P2^7; // 定义数码管的位选端sbit DUAN=P2^6; //定义数码管的段选端unint dat2; //定义全局变量,显⽰记录信息uchar Temp[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; //共阴极字段显⽰码void delay(){;;} //短延时声明void init() //初始化24C02{SDA=1;SCL=1;delay();}void start() //开始信号{SDA=1;delay();SCL=1;delay();SDA=0;delay();}void stop() //停⽌信号{SDA=0;delay();SCL=1;delay();SDA=1;delay();}void ack() //应答信号{uchar i;SCL=1;delay();while((SDA==1)&&(i<255))i++;SCL=0;delay();}void write_byte(uchar dat) //写⼀个字节{uchar i,temp;temp=dat;for(i=0;i<8;i++){SCL=0;delay();temp<<=1;SDA=CY;delay();SCL=1;delay();}SCL=0;delay();SDA=1;delay();}uchar read_byte() //读⼀个字节{unint i,j;SCL=0;delay();SDA=1;delay();for(i=0;i<8;i++) //循环8次读出⼀个字节数据{SCL=1;delay();j=(j<<1)|SDA;SCL=0;delay();}return j;}void write_addr(uchar address,uchar dat1){ //往指定地址写数据start(); //初始信号write_byte(0xa0); //写⼊芯⽚地址0XA0ack(); //应答信号write_byte(address); //写⼊芯⽚内部寄存器地址ADDRESS ack(); //应答信号write_byte(dat1); //写⼊数据ack(); //应答信号stop(); //停⽌信号}uchar read_addr(uchar address){ //从指定地址读数据uchar dat3;start(); //初始信号write_byte(0xa0); //写⼊芯⽚地址0XA0ack(); //应答信号write_byte(address); //写⼊芯⽚内部寄存器地址ack(); //应答信号start(); //初始信号write_byte(0xa1); //写⼊芯⽚地址0XA1ack(); //初始信号dat3=read_byte(); //读出数据stop(); //停⽌信号return dat3; //返回读出值}void init_T0() //初始设置定时器T0{TMOD=0x01; //定时器T0⼯作在⽅式1TCON=0x10; //启动T0TH0=(65536-461)/256; //FEH,11.059 2MHz,0.5ms TL0=(65536-461)%256; //33H,IE=0x82; //T0的中断允许}void wei_lock(uchar wei) //数码管位控制{WEI=1;P0=wei;WEI=0;}void duan_lock(uchar duan) //数码管段控制{DUAN=1;P0=Temp[duan];DUAN=0;}void display(uchar date) //数码管显⽰{unint i;uchar ge,shi,bai;ge=date%100%10;shi=date%100/10;bai=date/100;duan_lock(ge);wei_lock(0x7f);for(i=0;i<300;i++);duan_lock(shi);wei_lock(0xbf);for(i=0;i<300;i++);duan_lock(bai);wei_lock(0xdf);for(i=0;i<300;i++);wei_lock(0xff);}void timer0() interrupt 1 //T0的中断服务函数{unint i;if(i++>=2000) //1s时间到{i=0;if(dat2++>=255)dat2=0; //调整显⽰数字}TH0=(65536-461)/256; //重新给T0赋初值TL0=(65536-461)%256; }void main(){init_T0(); //T0初始化dat2=read_addr(0); //读24C02存储器数据while(1){init(); //存储器初始化write_addr(0,dat2); //指定地址写数据display(dat2); //读出数据并显⽰}}四、仿真分析1、原理图2、仿真结果图3、结果分析通过控制AT24C02芯⽚向指定的地址进⾏数据的读写操作,利⽤其记忆功能达到实验⽬的。
51单片机课程设计——单词记忆器的设计实现

字符的显示:用LCD显示一个字符时比较复杂,因为一个字符由6×8或8×8点阵组成,既要找到和显示 屏幕上某几个位置对应的显示RAM区的8字节,还要使每字节的不同位为“1”,其它的为“0”,为“1” 的点亮,为“0”的不亮。这样一来就组成某个字符。但由于内带字符发生器的控制器来说,显示字符 就比较简单了,可以让控制器工作在文本方式,根据在LCD上开始显示的行列号及每行的列数找出显示 RAM对应的地址,设立光标,在此送上该字符对应的代码即可。
三、系统程序流程图
CHAPTER
02
硬件电路设计
一、总电路系统
二、时钟脉冲和单片机复位模块
晶振是晶体振荡器的简称 在电气上它可以等效成一 个电容和一个电阻并联再串联一个电容的二端网络 电工学上这个网络有两个谐振点 以频率的高低分其 中较低的频率是串联谐振 较高的频率是并联谐振 由 于晶体自身的特性致使这两个频率的距离相当的接近 在这个极窄的频率范围内 晶振等效为一个电感 所以 只要晶振的两端并联上合适的电容它就会组成并联谐 振电路 这个并联谐振电路加到一个负反馈电路中就 可以构成正弦波振荡电路 由于晶振等效为电感的频 率范围很窄 所以即使其他元件的参数变化很大 这个 振荡器的频率也不会有很大的变化。
g
k
o
s
w
0111 d
h
l
p
t
x
CHAPTER
04
课设实现
模拟仿真软件测试
基于艾宾浩斯记忆曲线的单词记忆系统的设计与实现毕业论文

毕业设计中文题目基于艾宾浩斯记忆曲线的单词记忆系统的设计与实现英文题目Design and Implementation ofthe Word-Memory System Based onEbbinghaus Curve摘要摘要当前英语地位日趋重要,词汇量成为制约大部分人英语能力的障碍。
为帮助人们更加轻松、高效的完成单词记忆过程,本次项目将结合心理学原理设计开发一个基于B/S架构的单词记忆系统。
系统主要实现记忆单词的基本功能,如:基于艾宾浩斯记忆曲线的任务进程初始化、进程参数动态更新、记忆曲线每日修正、任务列表动态初始化、动态调整任务推送次序等核心功能。
与其他同类系统不同的是,该系统采用了心理学的研究成果,更符合人类的记忆活动,并能够根据用户的操作不断地更新用户的记忆曲线使之更符合用户个性化的记忆能力。
系统采用java编程,核心技术涉及:数据库编程、Strut2框架、轻量级数据交换格式JSON、ExtJS的Ajax数据代理模式及界面显示技术。
关键词:艾宾浩斯;单词记忆系统;记忆曲线更新ABSTRACTABSTRACTEnglish has being become more and more important, Limited vocabulary is a barrier to so many people. To help people remember words comfortable and more efficient. This project applied the psychological principles, design and implementation of system base-on B/S architecture. The system achieve basic function of remember words.The core business includes the following functions. Initialize a user forgetting curve base-on Ebbinghaus Curve.C urve’s parameters update dynamically by user operation. Refresh user curve. Generate a review plan by user forgetting curve.Unlike other wordmemory system, This system is base-on Ebbinghaus Curve so it can update C urve’s parameters dynamically.It means that it becomes more in accordance with human’s memory level. This system code in Java and it applied technique like: SQL programming, Struts2, JSON, Ajax, ExtJS.Key Words: Ebbinghaus Forgetting Curve;WordMemory system; Refresh user curve目录第1章开发背景 (1)1.1 目的和意义 (1)1.2 设计思想 (1)1.3 开发目标 (2)第2章使用技术说明 (3)2.1 Struts2 (3)2.2 SQL编程 (3)2.3 AJAX与ExtJS (3)2.4 JSON轻量级数据格式简介 (4)第3章系统需求分析 (5)3.1 引言 (5)3.1.1 项目背景 (5)3.1.2 假定和约束 (5)3.2 系统总体结构图 (5)3.3 系统功能模块分解 (6)3.3.1 用户模块 (6)3.3.2 词库模块 (6)3.3.3 记忆曲线模块 (7)3.3.4 复习计划模块 (7)3.3.5 复习模块及浏览模块 (8)第4章系统概要设计 (9)4.1 系统设计思想 (9)4.2 系统总体设计 (9)4.3 系统工程分离 (9)4.4 系统类结构设计 (10)4.4.1 数据模型 (10)4.4.2 DAO层 (10)4.4.3 业务逻辑层 (11)4.4.4 控制层 (11)4.5 数据库设计 (12)4.5.1 E-R模型 (12)4.5.2 物理模型 (14)第5章核心业务逻辑介绍 (17)5.1 核心业务逻辑层简述 (17)5.2 记忆曲线的相关业务逻辑详解 (20)5.2.1 记忆曲线初始化 (20)5.2.2 记忆曲线参数更新 (20)5.2.3 记忆曲线更新 (21)5.3单词复习的业务逻辑详解 (23)5.3.1 任务列表初始化 (23)5.3.2 复习单词的过程 (24)5.4 单词卡片式浏览时的业务逻辑详解 (26)5.4.1 文字说明 (26)5.4.2 选择这种方式的原因 (27)5.4.3方法的优点 (27)第6章系统实现 (28)6.1 核心模块实现效果及说明 (28)6.1.1 首页 (28)6.1.2 复习模块页面 (28)6.1.3 单词浏览页面 (29)6.1.4 数据分析 (30)6.2 新技术应用 (31)6.2.1 Extjs、Ajax、JSON (31)第7章系统测试 (34)7.1 测试对象和要点 (34)7.2 测试环境 (34)7.3 测试用例 (34)第8章结论与展望 (37)8.1 结论 (37)8.2 展望 (38)结束语 (39)致谢 (40)参考文献 (1)第1章开发背景1.1 目的和意义目前英语地位日趋重要,单词的词汇量是一个人英语能力及水平极大的重要体现, 而背单词依旧是困扰许多人的地方,原因如下:英语单词多而繁杂,面对整整一本的单词词典人们总是望而却步,不从何入手。
基于S3C44BOX的电子词典软件设计与实现DOC

基于S3C44BOX的电子词典软件设计与实现(DOC)基于S3C44BOX的电子词典软件设计与实现1 概述此次基于ARM7的电子词典系统开发作业,由我们小组4人合作完成,其中我主要负责软件方面的开发,所做的方面有英译汉软件功能的实现,输入值软件识别功能的实现以及看门狗定时器的实现。
由于不怎么熟悉arm的开发,基本是看着书做,设计思路和方法、功能实现也都是书上怎么来,自己就怎么实现,希望傅老师谅解,这块的基础确实薄弱。
2 S3C44BOX处理器介绍2.1 S3C44BOX简介S3C44BOX微处理器片类集成ARM7TDMI核,采用0.25μm CMOS工艺制造,并在ARM7TDMI核的基础上集成了丰富的外围功能模块,便于低成本设计嵌入式系统应用系统。
片上集成的主要功能如下:➢在ARM7TDMI基础上增加至8KB的Cache。
➢外部扩充存储器控制器(FP/EDO/SDRAM控制,片选逻辑)。
➢LCD控制器(最大支持256色的DSTN),并带有一个LCD专用DMA通道。
➢2个通用DMA通道2个带外部请求引脚的DMA通道。
➢2个带有握手协议的UART,1个SIO。
➢1个多主的I2C总线控制器。
➢1个I2S总线控制器。
➢5个PWM定时器及1个内部定时器。
➢看门狗定时器。
➢71个通用可编程I/O口,8个外部中断源。
➢功耗控制模式:正常,低速,休眠和停止。
➢8路10位ADC。
➢具有日历功能的RTC(实时时钟)。
➢PLL时钟发生器。
2.2 S3C44BOX特点2.2.1 S3C44BOX体系结构➢S3C44BOX是基ARM7TDMI体系结构的SOC。
➢集成了手持设备和通用嵌入式系统应用的解决方案;➢16/32位RISC体系结构和ARM7TDMI处理器内核强大的指令体系;➢Thumb代码压缩机,最大化代码密度同时保持了32位指令的性能;➢基于JTAG的片上集成ICE调试支持解决方案;➢32×8位硬件乘法器;➢实现低功耗SAMBA II(三星ARM处理器嵌入式微控制器总线体系结构)的新型总线结构。
基于某单片机地单词记忆器设计

大学能源与动力工程学院课程设计报告题目:单词记忆测试器程序设计课程:单片机原理与应用课程设计专业:电气工程与其自动化班级:电气1102姓名:学号:第一部分任务书《单片机原理与应用》课程设计任务书一、课题名称单词记忆测试器程序设计二、课程设计目的课程设计是课程教学中的一项重要容,是达到教学目标的重要环节,是综合性较强的实践教学环节,它对帮助学生全面结实地掌握课堂教学容、培养学生的实践和实际动手能力、提高学生全面素质具有很重要的意义。
《单片机原理与应用》是一门理论性、实用性和实践性都很强的课程,课程设计环节应占有更加重要的地位。
单片机原理与应用课程设计的目的是让学生在理论学习的根底上,通过完成一个涉与MCS-51单片机多种资源应用并具有综合功能的小系统目标板的设计与编程应用,使学生不但能将课堂上学到的理论知识与实际应用结合起来,而且能进一步加深对电子电路、电子元器件等知识的认识与理解,同时在软件编程、排错调试、相关软件和仪器设备的使用技能等方面得到较全面的锻炼和提高。
为今后能够独立进展某些单片机应用系统的开发设计工作打下一定的根底。
通过单片机硬件和软件设计、调试、整理资料等环节的培训,使学生初步掌握工程设计方法和组织实践的根本技能,逐步熟悉开展科学实践的程序和方法。
三、课程设计容设计以89C51单片机和外围元器件构成的单片机应用系统,并完成相应的软硬件调试。
1. 系统方案设计:综合运用单片机课程中所学到的理论知识,学生根据所选课题的任务、要求和条件进展总体方案的设计。
2. 硬件电路设计:对方案中以单片机为核心的电路进展设计计算,包括元器件的选择和电路参数的计算,并画出总体电路图。
3. 软件设计:根据已设计出的软件系统框图,用汇编语言或C51编制出各功能模块的子程序和整机软件系统的主程序。
4. 调试:在单片机EDA仿真软件环境Proteus下进展仿真设计并调试;或在单片机周立功实验箱上进展相关设计并调试。
基于单片机的防盗报警器的设计(英文翻译)

本科生毕业设计(翻译)Multifunctional Intelligent Wireless AlarmSystemAbstract:Making use of rich inner resource of FPGA(Field Programmable Gate Arrays), a wireless alarm sending system is designed. It includes encoder, FSK(Frequency Shift Keying) modulat ion and every channel’s control circuits, which can decrease volume and increase reliability of the alarm system.The demodulation of receive system is realized by an application specific integrated circuits MC3372. With the help of a single-chip microcomputer 89C51, the address decoder is also designed in the receiver. Adding to other anti-interference,the alarming system has effectively decreased the error-alarm rate.The system can install up to 128 channel sending devices. It can send an alarm to the host when there are some cases in stand-off areas, and the system will display on rotation multiple cases’ area codes . The transmission distance is greater than 4Km in open zones. User can install more than one type sensors simultaneously, for example, smog sensor, combustible gas sensor or burglar sensor. Experiments show that the wireless alarm system has the strengths of high reliability, high anti-disturbance ability and low error-alarm rate. It can entirely meet the needs of alarm fireproofing and guard against theft, etc.Keywords: communication; Alarm systems; Frequency Shift Keying; Micro-controllers; Field Programmable Gate ArraysI.INTRODUCTIONCompared with a wired alert system, a wireless alarm system has characteristics of covertness and ease of installation. It is especially effective when transmitting between long distances in a complex landform situation. Made up of FPGA (Field Programmable Gate-Array), the encoding module in the sending system creates the address signal, FSK (frequency shift keying) modulates the signal and each channel’s controller signals. Using FPGA to replace MSI/SSI (Middle Scale Integrated or Small scale Integrated) digital circuit devices, not only increase the reliability and the resistance to interference of the alarm system, but it also decreases its volume and makes the system easier to install. Since used 7 bits binary number to express the address, up to 128 channels sender can be installed. The decoder consists of ASIC (Application Specific Integrated Circuit) and SCM in the wireless alarm receiver system, which can effectively decrease the error-alarm rate.II.THE SENDING SYSTEM PRINCIPLEEach stand-off is equipped with a wireless sending system,and corresponds with a 7 bits address identifier in binary. Once a case is detected by a sensor in any stand-off, a control signal of this area is sent to its encoding circuit via interface circuit, which converts the area’s 7bit address identifier into FSK signal. Then FSK signal is transmitted into a frequency modulation circuit for frequency modulating. After power amplification, the frequency modulation electromagnetic wave is emitted via antenna. Onecharacteristic of the sending system is discontinuous sending. In other words, the sending system does not send signals when there is no case, and do keep sending when there is an alarm situation, so as to provide chances to send signals for other stand-off areas.A.The Encoding and Controlling Circuit ConfigurationThe digital circuit part of the encoding circuit is made by a FPGA chip which includes 8 modules.Formed by D triggers, module ‘dff1’ is the interface between detector and encoder. Module ‘oscillator’ combines with some external resistors and capacitors to form a controllable low frequency multivibrator. Its control signal is the output of ‘dff1’---Q1. It does not vibrate when Q1is equal to 0, and if Q1is equal to 1, it vibrates to generate low frequency square waves. If some cases appear in the area, the oscillator controls the mo dule ‘SENDER’ to send electromagnetic wave discontinuously. The module ‘circular_shift_r’ is a parallel input serial output circular shift register. The bit A0~A7 are the parallel address code input terminals, which are joined to high or low voltage level according to the encoder requirement. Q8 is the serial output terminal of the address code. Module ‘dff2’ is a control circuit that is made of some JK triggers. Its setup signal is Q1, which also acts as a trigger signal after delay. Q2 acts as the parallel-in-serial-out control terminal of the‘circular_shift_r’ module. When Q2 is at high voltage level,circular_shift_r’ performs parallel input. When Q2 is at low voltage level, ‘circular_shift_r’ executes serial output. The module ‘delay1’ is a delay circuit composed of D triggers.The module ‘division’ is a frequency division that creates three different routes frequency output signals, two of which branches and act as FSK modulating signals: f1 and f2. The other branch acts as a triggering pulse for modules dff1 and delay1, and alsoacts as the clock pulse of ‘circular_shift_r’for performing serial-out. The module ‘MUX’ is a 2 to 1multiplexer. Its control signal is the output Q8 of‘circular_shift_r’. When Q8=0, ‘MUX’ produces the signal f2, and when Q8=1, it exports f1. The module ‘delay2’combines with some external resistors and capacitors to form a delay circuit. Its function is to give workers some time to leave after installing the system. The sending circuit does no work within the delay time, no matter whether K1(detector) is on or off. This is the external connection drawing of the FPGA chip.B. The Working PrincipleAs shown following, the working principle of the alarm system is as follows: when the power of the sending system turns on, the input of the ‘dff1’ is at low level. Then its output terminal Q1 is at logic value ‘0’, NQ1 is at logic ‘1’, and a external light-emitting diode (LED) is lit to indicate the power is on. The signal Q1 is sent to the setting terminal of ‘dff2’ to set terminal Q2 at high level. The high level Q2 will set ‘circular_shift_r’ into the parallel input address code mode. At this time, the outer transistor N2 is at saturation state and N3 at cut-off state. This makes the sending circuit at a passive state, therefore, the circuit will not work. Hence, the circuit does not emit carrier wave if there is no case, and it is at low consumable power state.Once some cases appear, the switch K1 is on. The terminal D of the ‘dff1’ turns to high level immediately, and the output Q1of ‘dff1’ is set to high level at the rising edge of the clock pulse. It makes the setting terminal s of ‘dff2’ at high level too. The ‘dff2’ now is at normal working state. After delaying by module ‘delay1’, the former edge of the Q1 pulse will trigger ‘dff2’ to output low voltage, which will make the transistor N2 off, N3 on, and the delay’s normally open contact will be closed. The electric power supply to the sending circuit is on, and the circuit begins to work normally.Simultaneously, if Q2 is at logi c 0, ‘circular_shift_r’ will be change to serial shift state and export address signals. When the address code is 0, the output of ‘MUX’ will be f2. And when the address code is 1, the output will be f1. Terminals f2 and f1 act as the modulation signal for modulating the carrier wave. In this way, the address code is sent out at the first cycle of the low frequency oscillator. At the second cycle it stops sending in order to give other stand-off a period of time to send. After the third cycle, repeat the procedure above.From the discussion above, we have the conclusion that the encoding and control circuit have the function to display when the power is on, time delay for human to leave the spot, low power cost mode for waiting case, discontinuity sending and FSK modulating etc. It is more flexible and has more functions than many encoder ASIC.III.THE CONFIGURATION AND PRINCIPLE OF THE RECEIVING SYSTEMSet in guardhouse, a set of wireless receiver takes charge of monitoring all stand-off areas. The principle of the wireless receiver is show following. Passing by the low pass filter, the received modulation signal is sent into the high frequency common-emitter and common-base configuration cascade amplifier for amplifying. Then the signal is sent to the intermediate frequency modulation amplifier via the dual tuning circuit, i.e. sent into the input terminal (16th pin) of an ASIC chip (MC3372) to do mixing. The oscillate frequency of the local oscillator circuit is 455KHz higher than the received signal. Delivering to the first pin of the chip MC3372, the signal will mix with the external signal to get 455KHz intermediate frequency signal. After filtering, the intermediate frequency signal is first delivered to the 8th MC3372 pin to do frequency detection, and second amplified by an inner lowfrequency amplifier of the chip MC3372, then the 9th pin exports the baseband signal. Amplified by a low frequency single transistor, the baseband signal is rectified by two steps Schmitt gates (CD4584) to turn into a FSK signal, which will be sent into pin 3.0 of MCS to be decoded.MCS in this system is chip 89C51, which joins an outer 12MHZ crystal oscillator. Its timer T1 act as a baud rate generator in mode 2, and SMOD=1,300 baud/sec. serial port is selected in mode 1, which means an asynchronous communication mode, 10 bit per frame in which the lower 7 bits of the 8 data bit is the address code, and the 8th acts as the parity check bit. The system uses even check.When receiving an address code, the MCS firstly performs parity check. If it is correct ,then ,the MCS compare their value and takes out 7 bits address code and stores it into data buffer in memory. These procedures repeat 3 times in order to identify the 3 address codes. If the 3 address codes are the same, the MCS will confirm that the receiving address signal is an effective alarm signal, that is to say, the address code is not a noise signal. It then triggers the alarm circuit to send the alarm sound. At the same time, the code number will display on the LED indicating which stand-off triggered the alarm.The LED uses a dynamic scan display method. If there are more than one stand-off areas have cases simultaneously, the MCS will display their code number in turn at 3 seconds intervals. The alarm audio process circuit uses a NE556 dual time base circuit chip to form a dual audio frequency multivibrator, which will give off a ringing alarm sound. System could configure sensors use for alarm of fire,combustible gas and theft.IV.ANTI-INTERFERENCE MEASUREIt is important to heighten the anti-interference ability for wirelesscommunications. anti-disturbance measures takes form in the hardware. For example, one should reasonably arrange the PCB (printed circuit board),increase power decoupling, and place the high and low frequency filter reasonably. Since the receiver system includes high frequency circuits, separate the analogue circuit and digital circuit chip, and make each have its own ground. To guard against external and internal interference or high frequency radiation, put the high frequency amplifier and middle frequency amplifier channels in a metallic shield box and the MCS system into another metallic shield casket. Adopt FSK modulation, double tuning select frequency and ASIC demodulation. All of these measures can effectively decrease interference to the system. For software, use the modular structure to design the software system. Continuously distinguishing address code several times and by parity check can dramatically reduce the error-alarming rate of the system.V.THE ENDINGThe design of software and hardware in this alarm system is reasonable. Its reliability is observably increased, and the error alarm rate is decreased. Experiments show that the error alarm rate is nearly zero when disconnecting the detector. The transmission distance is greater than 4Km in open zones When connecting microwave dual discriminating theft-proof detector (DT-400 Family), the error alarm rate is less than 4 times every 1000 hours. Since working in the discontinuously sending method at 300baud/s, the alarm system can work reliably as long as the time gap between two sending systems is less than 0.2sec. In fact, it can meet the need in actual applications.Intelligent Residential Security Alarm and Remote Control System Based On Single Chip ComputerAbstract:For to steals, robs and so on accidents to carry on the effective monitor and the warning, unified using the MCU AT89C51 controlling technology and the infrared detection technology, one kind of wireless burglar alarm has been designed, it including hardware and software two parts; The hardware part is composed by the infrared sensor, send and receive module ,MCU, acousto-optic warning and so on; The software part is composed of the main program and music subroutine. With C or the assembly language compilation source program, carries on the translation and the debugging in the Keilc51 platform, after downloads to the MCU AT89C51 chip, and this MCU and other primary devices welding on the PCB board according to design a circuit. On electricity, closed-cycle control switch, when some people intrude in the infrared launch area, has the acousto-optic warning, indicated that has achieved the design requirements.This paper presents intelligent residential burglar alarm, emergency alarm, fire alarm, toxic gas leakage remote automatic sound alarm and remote control system, which is based on 89C51 single chip computer. The system can be automatic alarm, automatic calling the police hotline number. It can be used voice alarm and show alarm occurred address. It can set up and modify user password. It can be recordable and voice suggestion. It can be used telephone remote control electrical power. The alarm system has design innovation, multiply function,low cost, high reliability and so on.Along with time unceasing progress, the people located the environment security to oneself to propose a higher request, it was living at the security aspect particularly, it must pay attention these unexpected visitors frequently. Now many plots have installed the intelligence alarm system, thus enhanced the plot safety rate greatly, because infrared is a black light, uses the wireless launch and the receive, does not need the independent wiring,it has the very strong confidentiality and the secrecy, thus in security, security installments and so on security the use should have the very big superiority.Keywords- Infrared sensor; Launch; Receive; MCU(Micro Controller Unit); WarningI.INTRODUCTIONWith the computer technology and control technology and communicational technology’s development, people’s living standard has improved increasingly. People's living conditions have changed, Such as the living environment’s security and how comfortable they feel. So the intelligent residential building’s automatic emerge as the times require. Intelligent residential must have safety precautions, anti-theft alarm, fire alarm, toxic gas leakage automatic alarm and emergency call. It is able to implement remote control for the key equipment power. In recent years, with the progress of technology and economy, the electronic anti-theft alarm system has rapid development and a very wide application. Now it does not only apply in many important government departments, but also apply in the family.In-depth study on various alarm device, we have designed intelligent residential security alarm and remote control system on the basis of single chip computer. The system is based on 89C51 single chip computer, hasintelligent residential burglar alarm, emergency call alarm, fire alarm, toxic gas leakage automatic alarm and remote control. It is able to call the police hotline number. It is able to use voice alarm and show alarm occurred address. Users can set up and modify password for it. It can be recordable and voice suggestion and make use of the telephone to remote control. Calling when is not at home, it can use password to enter remote deployment and remote control the power of electronic appliance.The system makes use of communication equipment to realize multi-channel detection, scene alarm, emergency alarm, fire alarm and toxic gas leakage automatic alarm. It realizes remote voice alarm function through the automatic dial-up telephone. It directly parallels on the telephone lines, then may be used. Before used, user will be required to install the detection device in place where being watched by people. It must be set up alarm telephone number, recorded voice alarm. The alarm system has design innovation, multiply function, low cost, high reliability and so on.II.SYSTEM COMPONENTIntelligent residential security alarm and remote control system constitutes as shown following. The system is through telephone interface circuit and telephone network to link up. 89C51 single chip computer dominates by MT8880 Dual Tone Multi-frequency (DTMF) codec with the telephone network to exchange information. When the detection of dangerous situations, the dangerous situation coded signal transfer from the corresponding detection module through the antenna to master chip. The master chip brings the corresponding alarm information according to received signal. This part is to complete by the voice interface circuit, which uses ISD1420. After users call the number of system, users can control appliances according to sound by the voice interface circuit.The system components are made up of detecting circuit, wireless transmitter-receiver circuit, telephone interface, voice circuit, DTMF codec circuit, telephone signal detection circuit and the main control circuit. Each module is described as follows:A.Detecting CircuitThe part circuit is as the detection part of the whole system, used to detect theft case, fire, toxic gas leakage and emergency call signals. Theftproof detection is to complete through pyroelectric infrared sensor. Sensors are installed on the balcony, windows and other place where thieves are easy to enter. The part circuit is at the ready state under normal circumstance. Sensors catch theft information when someone enters the scope of the surveillance. Then, wireless module will send the information to the 89C51 single chip computer. The detection of fire and toxic gas is to complete by the corresponding detection sensors, emergency call signal is sent from user hand-hold remote control.B.Wireless Transmitter-receiver CircuitThe transmitting and receiving circuit of the part makes use of CMOS manufacturing process produced by a low cost PT2262/PT2272 wirelessremote control module. The operating frequency of it is 2 MHz and the communication distance of it is 100 meters above. Under normal circumstances, transmitting and receiving modules are in dormant status. The module is in non-dormant status when be in danger, then coded signal is transmitted. The receiving module has received high-frequency signal decode, generating interrupt signal at the same time.C.Telephone InterfaceHere shows telephone interface circuit. The phone lines normal is above 48V DC voltage and optocoupler is not conducting. When the phone lines are ringing signal which is 25±3V sine wave, Optocoupler is conducting, generating interrupted signal to the mainframe. The relay will be connected to J1,after mainframe detected ringing signal many times, then load resistor connected to a telephone line, that computer to simulate the extraction process. Since then, the system access DTMF signals from the TONE of coupled transformer, transmits voice signals from VOICE of coupled transformer. To disconnect the system, the system rings off.D.Voice CircuitThe voice circuit of system is used to generate alarm information and hint information. Using specialized voice integrated chip ISD1420, which provides 20 seconds recording time. Using subsection record, master audio recorder provides the starting address.E.DTMF Codec CircuitUsing MT8880 codec chips, to complete dial up function and decode passwords and control commands which are sent by users.F.Telephone Signal Detection CircuitThe telephone signal detection circuit uses pulse reshaping circuit design. The signal must be amplified by the signal amplifier circuit, then, to generate square wave signals to main control chip by comparator. Phone signals including dial tone, busy tone, call waiting tone, ring back tong, network busy tone relies on software to identify.G.The Main Control CircuitThe system adopt 89C51 chip as main control chip, the main controller call by detecting ring tone. Tone control circuits broadcast voice tone, to coordinate the competence of users who have complete remote control electrical appliances. On the other hand, Mainframe controls dial-up circuit given the preset number according to receiving alarm information.According to the alarm type of telephone sound, determine to call police or tell user the information. User may preset passwords, telephone number and record, and so on.III.SYSTEM SOFTWARE DESIGNSystem software is composed of main program, remote control subroutine, warning subroutine. In order for the system in idle time to enter a dormant mode, all the tasks are completed in interrupted service routine.A.Main program designHere shows main program flow chart. It mainly accomplishes initialize work, then the system enters a dormant mode. Whether there is password input or imported alarm. The results are processed accordingly. A method of determining whether to provide a user with access to the security system,enter a user password for verification by a program in a computing device. When valid user leaves, the main program waits for some time, automatically enters the maximum security state. The main program regular calls watchdog handling procedure, in order that the system is not normal reset.B.Remote Control ModulesWhen there is a ringing signal, remote control modules generate external interrupt. The number of the ring counts in interruption procedure, if the number is more than six times, the system hangs off, broadcasts hint tone to the telephone network. Then checking user passwords, if passwords are valid, user may control the work of electronic appliances. And the times of password input are limit. Check whether connection is overtime or not, hang up if it is overtime.C.Remote Alarm ModuleAn interrupt handler of remote alarm, also known as an interrupt service routine (ISR), is a callback subroutine in an operating system or device driver whose execution is triggered by the reception of an interrupt. When receiving module receives signals, main controller generates interruption, is out of dormant. Proceedings interrupted in this way shall continue from the point where they were interrupted, if making the interrupt trigger. For example, when the system withdraws from a defend position, the system ignores the security which has received alarm signals.After dialing has finished, we must judge by phone tone whether the call has been put through. If not, we want to repeat the dialing. We just hang up the telephone then repeat,otherwise, play alarm information to the other. The function is to complete by signal tone detection routine. System must identifysignal tone, in order to identify the signal tone, we must know the characteristic of signal tone.IV.THE SYSTEM TESTING SHOULD MEET THE FOLLOWING REQUIREMENTa.Guard against theft and alarm system: Be able to dial preset telephone number and alarm telephone number, tell people by phone tone where the accident has happened.b.Emergency alarm: Be able to dial preset telephone number and emergency telephone number, tell people by phone tone where the accident has happened.c. Fire alarm and record hint: Be able to dial preset telephone number and fire alarm telephone number, tell people by phone tone where the accident has happened. And there is toxic gas leakage automatic alarm and emergency call.d. Be able to set up password and alarm telephone number, then modify theme. Remote control the power of appliancesV.THE EXPERIMENTAL RESULTSAccording to the program flow diagram with C or the assembly language compilation main program and music subroutine, carries on the debugging in the Keilc51 environment, will debug the good procedure using the programmer to solidify to MCU AT89C51. With the infrared sensor, the launch module, the receive module, the MCU, the acousto-optics alarm circuit welding on the PCB board according to the request, puts through the power source, the green power light is bright, indicated that the power sourcework is normal; When separation alert control switch, the alarm circuit does not work, therefore when some people intrude in the infrared launch area, also will not have the warning, when after closed alert control switch, the indicating lamp will be bright, indicates the alarm circuit in the work, when this time some people will intrude in the infrared launch area, will have the acousto-optic warning, namely the buzzer will send out music, red light emitter diode twinkle. The alert control master switch's function, causes the infrared burglar alarm's use to be more convenient, when the master wants to greet the visitor, may separate the alert control master switch, the visitor walks into the guard area not to report to the police; When the master wants to guard against theft, then closed alert control master switch, when has the unexpected visitor to intrude the guard zone time, will carry on the acousto-optic warning.VI.CONCLUSIONThis paper presents intelligent residential burglar alarm, emergency alarm, fire alarm, toxic gas leakage remote automatic sound alarm and remote control system, which is based on 89C51 single chip computer. The system communicates with terminal through public telephone network and mobile network, is able to dial preset telephone number and alarm telephone number automatically. We know what has happened according to tone dialer and where has happened. We can set up and modify passwords, be able to record and tone hints. We can use telephone or mobile phone to lay guards, withdraw guards, remote control the power of appliances. The alarm system has design innovation, multiply function, low cost, high reliability and so on. The system enhances the level of intelligent alarm system. Using the MCU and the wireless communication technology, may realize the wireless warning, between the wireless sensor and the MCU uses the ASK modulationand demodulate , with releases the infrared sensor to carry on the examination hotly, the installment hiding, the overall system does not need the independent wiring, it is suitable erects communication link's place inconveniently in the cities family and the remote districts ,and so on, it should have the good application prospect.多功能智能无线报警系统摘要:利用内部资源丰富的FPGA(现场可编程门阵列),设计了一个无线报警发送系统。
单词记忆测试器C程序源代码(单片机)

单片机单词记忆测试器C程序源代码/************************************************************************ /**单片机单词测试程序/**设计一个以单片机为核心的单词记忆测试器;/** 实现单词的录入(为使程序具有可演示性,单词不少于10个);/**单词用按键控制依次在屏幕上显示,按键选择认识还是不认识,/**也可以直接进入下一个或者上一个;/**单词背完后给出正确率。
/*************************************************************************/ #define uchar unsigned char#define uint unsigned int#include <reg52.h>#include "asc.h" //ASCII字模表#include "12864.h" //12864液晶屏底层驱动程序bit ERROR=1; //输入字符错误标志位bit result=0; //输入结果对错的标志位,为0是正确bit verify=1; //已按了确认键后清零sbit ERR=P2^7;uchar correctNUM; //统计测试正确的单词数,即得分/*****************************************/** 存储要测试的单词,放在ROM中/****************************************/uchar code S[10][5]={ "left ", //左"bird ", //鸟"book ", //书"tree ", //树"water ", //水"go ", //去"come ", //来"rain ", //雨"fly ", //飞"eat ", //吃} ;uchar code SL[10]={4,4,5,3,2,4,4,3,4,3};//存储各测试单词的长度uchar KeyNum[8]; //储存输入的单词/*****************************************/** 存储键盘的字母值,放在ROM中/****************************************/uchar code tab1[6][5]={{'a','b','c','d','e'},{'f','g','h','i','j'},{'k','l','m','n','o'},{'p','q','r','s','t'},{'u','v','w','x','y'},{'z',1,2,3,4}};//最后的1234 键盘值为功能键,1表示确定键,2表示不认识,3表示上一个,4表示下一个/*************************************************** 键盘扫描程序*************************************************/unsigned char kbscan() //键盘扫描{uchar hang,lie,key; //P1连行,P3连列if(P1!=0xFF||P3!=0){switch(P1&0xFF) //P1 扫行{case 0xFE:hang=5;break;//P1.0为第6行case 0xFD:hang=4;break;//P1.1为第5行case 0xFB:hang=3;break;//P1.2为第4行case 0xF7:hang=2;break;//P1.3为第3行case 0xEF:hang=1;break;//P1.4为第2行case 0xDF:hang=0;break;//P1.5为第1行}P1=0; //P1全低电平P3=0xFF;//P3全高电平switch(P3&0xFF){case 0xFE:lie=4;break; //P1.0为第5列case 0xFD:lie=3;break; //P0.5为第4列case 0xFB:lie=2;break; //P0.6为第3列case 0xF7:lie=1;break; //P0.7为第2列case 0xEF:lie=0;break; //P0.7为第1列}P1=0xFF; //P1全高电平P3=0; //P3全低电平while(P1!=0xFF||P3!=0); //按键松开后才返回值key=tab1[hang][lie];}elsekey='_';return (key);}/************************************************************************/** 主函数/**/**/*************************************************************************/void main(void){uchar hz_Num; //用于计当前测试的是第几个词,第一个为0 uchar temp[8]; //用于送液晶屏显示的临时变量uchar iword=0,Nword=0; //输入单词字母下一个计数LCD12864_init(); //LCD12864初始化ClearLCD(); //清屏en_disp(2,1,11,Asc,"INPUT WORD:",1); //在第2行第1列en_disp(4,1,1,Asc,">",1); //在第5行,第2列开始显示en_disp(6,0,8,Asc,"correct:",1); //在第7行,第1列开始显示en_disp(6,80,5,Asc,"00/10",1); //在第7行第81列P1=0xFF; //P1全高电平P3=0; //P3全低电平while(1){KeyNum[iword]=kbscan(); //扫描键盘的输入值,没按下时返回下横线hz_disp(0,48,1,hz1+hz_Num*32,1); //在第1行,第49列开始显示测试的汉字temp[0]=(hz_Num+1)/10+0x30; //将十进制数转换为ASCII字符temp[1]=(hz_Num+1)%10+0x30; //算出测试汉字的序号的第一位和第二位en_disp(0,20,1,Asc,":",1); //在第1行第21列en_disp(0,4,2,Asc,temp,1); //在第1行第5列显示测试序号if(KeyNum[iword]!='_') //键盘有按键按下{if(KeyNum[iword]==1) //如果按下了确定键{if(SL[hz_Num]==iword&&verify) //输入长度等于测试单词的长度,则正确,verify 表示按下了确认后有效一次{correctNUM+=1;if(correctNUM>10){correctNUM=10; //最多10个正确的}verify=0; //标志位清零hz_Num++; //测试下一个单词if(hz_Num==10) hz_Num=0; //最多设10个单词temp[0]=(correctNUM)/10+0x30; //将十进制数转换为ASCII字符temp[1]=(correctNUM)%10+0x30; //算出测试汉字的序号的第一位和第二位en_disp(6,80,2,Asc,temp,1); //在第7行第81列iword=0;Nword=0;en_disp(4,16,8,Asc," ",1); //在第5行,第17列开始显示}}else if(KeyNum[iword]==2||KeyNum[iword]==4)//如果按下了“不认识”或“下一个”键,直接跳到下一个单词{result=0; //跳下一个时错误灯灭ERROR=0;hz_Num++; //测试下一个单词if(hz_Num==10) hz_Num=0; //最多设10个单词iword=0;Nword=0;en_disp(4,16,8,Asc," ",1); //在第5行,第17列开始显示}else if(KeyNum[iword]==3) //如果按下了“上一个”键,直接跳到上一个单词{result=0; //跳下一个时错误灯灭ERROR=0;//测试下一个单词if(hz_Num==0) hz_Num=10; //最多设10个单词hz_Num--;iword=0;Nword=0;en_disp(4,16,8,Asc," ",1); //在第4行,第16列开始显示}else if(S[hz_Num][iword]==KeyNum[iword]) //输入的字符与测试的标准字符比较{ temp[0]=KeyNum[iword];ERROR=0; //正确就标志位置0en_disp(4,Nword+16,1,Asc,temp,1); //在第5行,第17列开始显示iword++;if(iword==8) iword=0;Nword=iword*8;verify=1;}else{ temp[0]=KeyNum[iword];ERROR=1; //错误就置1en_disp(4,Nword+16,1,Asc,temp,1); //在第5行,第17列开始显示iword++;if(iword==8) iword=0;Nword=iword*8;}result=ERROR|result; //0表示结果正确}ERR=!result; //错误指示灯}}/***********************************************************/* ASCII字模的数据表/* 码表从0x20~0x7e 即ASCII的32-127/* 纵向取模下高位8x16/*********************************************************/ unsigned char code Asc[] = // ASCII 表{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // - -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xFC,0xFC,0x38,0x00,0x00, // -!-0x00,0x00,0x00,0x0D,0x0D,0x00,0x00,0x00,0x00,0x0E,0x1E,0x00,0x00,0x1E,0x0E,0x00, // -"-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xF8,0xF8,0x20,0xF8,0xF8,0x20,0x00, // -#-0x02,0x0F,0x0F,0x02,0x0F,0x0F,0x02,0x00,0x38,0x7C,0x44,0x47,0x47,0xCC,0x98,0x00, // -$-0x03,0x06,0x04,0x1C,0x1C,0x07,0x03,0x00,0x30,0x30,0x00,0x80,0xC0,0x60,0x30,0x00, // -%-0x0C,0x06,0x03,0x01,0x00,0x0C,0x0C,0x00,0x80,0xD8,0x7C,0xE4,0xBC,0xD8,0x40,0x00, // -&-0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0x00,0x00,0x10,0x1E,0x0E,0x00,0x00,0x00,0x00, // -'-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF8,0x0C,0x04,0x00,0x00, // -(-0x00,0x00,0x03,0x07,0x0C,0x08,0x00,0x00,0x00,0x00,0x04,0x0C,0xF8,0xF0,0x00,0x00, // -)-0x00,0x00,0x08,0x0C,0x07,0x03,0x00,0x00,0x80,0xA0,0xE0,0xC0,0xC0,0xE0,0xA0,0x80, // -*-0x00,0x02,0x03,0x01,0x01,0x03,0x02,0x00,0x00,0x80,0x80,0xE0,0xE0,0x80,0x80,0x00, // -+-0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -,-0x00,0x00,0x10,0x1E,0x0E,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, // ---0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -.-0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x60,0x30,0x00, // -/-0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0xF8,0xFC,0x04,0xC4,0x24,0xFC,0xF8,0x00, // -0- 0x07,0x0F,0x09,0x08,0x08,0x0F,0x07,0x00,0x00,0x10,0x18,0xFC,0xFC,0x00,0x00,0x00, // -1- 0x00,0x08,0x08,0x0F,0x0F,0x08,0x08,0x00,0x08,0x0C,0x84,0xC4,0x64,0x3C,0x18,0x00, // -2- 0x0E,0x0F,0x09,0x08,0x08,0x0C,0x0C,0x00,0x08,0x0C,0x44,0x44,0x44,0xFC,0xB8,0x00, // -3- 0x04,0x0C,0x08,0x08,0x08,0x0F,0x07,0x00,0xC0,0xE0,0xB0,0x98,0xFC,0xFC,0x80,0x00, // -4- 0x00,0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x7C,0x7C,0x44,0x44,0xC4,0xC4,0x84,0x00, // -5- 0x04,0x0C,0x08,0x08,0x08,0x0F,0x07,0x00,0xF0,0xF8,0x4C,0x44,0x44,0xC0,0x80,0x00, // -6- 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00,0x0C,0x0C,0x04,0x84,0xC4,0x7C,0x3C,0x00, // -7- 0x00,0x00,0x0F,0x0F,0x00,0x00,0x00,0x00,0xB8,0xFC,0x44,0x44,0x44,0xFC,0xB8,0x00, // -8- 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00,0x38,0x7C,0x44,0x44,0x44,0xFC,0xF8,0x00, // -9- 0x00,0x08,0x08,0x08,0x0C,0x07,0x03,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, // -:-0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, // -;-0x00,0x00,0x08,0x0E,0x06,0x00,0x00,0x00,0x00,0x80,0xC0,0x60,0x30,0x18,0x08,0x00, // -<- 0x00,0x00,0x01,0x03,0x06,0x0C,0x08,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, // -=- 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x08,0x18,0x30,0x60,0xC0,0x80,0x00, // ->- 0x00,0x08,0x0C,0x06,0x03,0x01,0x00,0x00,0x18,0x1C,0x04,0xC4,0xE4,0x3C,0x18,0x00, // -?- 0x00,0x00,0x00,0x0D,0x0D,0x00,0x00,0x00,0xF0,0xF8,0x08,0xC8,0xC8,0xF8,0xF0,0x00, // -@- 0x07,0x0F,0x08,0x0B,0x0B,0x0B,0x01,0x00,0xE0,0xF0,0x98,0x8C,0x98,0xF0,0xE0,0x00, // -A- 0x0F,0x0F,0x00,0x00,0x00,0x0F,0x0F,0x00,0x04,0xFC,0xFC,0x44,0x44,0xFC,0xB8,0x00, // -B- 0x08,0x0F,0x0F,0x08,0x08,0x0F,0x07,0x00,0xF0,0xF8,0x0C,0x04,0x04,0x0C,0x18,0x00, // -C- 0x03,0x07,0x0C,0x08,0x08,0x0C,0x06,0x00,0x04,0xFC,0xFC,0x04,0x0C,0xF8,0xF0,0x00, // -D- 0x08,0x0F,0x0F,0x08,0x0C,0x07,0x03,0x00,0x04,0xFC,0xFC,0x44,0xE4,0x0C,0x1C,0x00, // -E- 0x08,0x0F,0x0F,0x08,0x08,0x0C,0x0E,0x00,0x04,0xFC,0xFC,0x44,0xE4,0x0C,0x1C,0x00, // -F- 0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0xF0,0xF8,0x0C,0x84,0x84,0x8C,0x98,0x00, // -G- 0x03,0x07,0x0C,0x08,0x08,0x07,0x0F,0x00,0xFC,0xFC,0x40,0x40,0x40,0xFC,0xFC,0x00, // -H- 0x0F,0x0F,0x00,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00,0x04,0xFC,0xFC,0x04,0x00,0x00, // -I- 0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0x00,0x04,0xFC,0xFC,0x04,0x00, // -J- 0x07,0x0F,0x08,0x08,0x0F,0x07,0x00,0x00,0x04,0xFC,0xFC,0xC0,0xF0,0x3C,0x0C,0x00, // -K- 0x08,0x0F,0x0F,0x00,0x01,0x0F,0x0E,0x00,0x04,0xFC,0xFC,0x04,0x00,0x00,0x00,0x00, // -L- 0x08,0x0F,0x0F,0x08,0x08,0x0C,0x0E,0x00,0xFC,0xFC,0x38,0x70,0x38,0xFC,0xFC,0x00, // -M- 0x0F,0x0F,0x00,0x00,0x00,0x0F,0x0F,0x00,0xFC,0xFC,0x38,0x70,0xE0,0xFC,0xFC,0x00, // -N- 0x0F,0x0F,0x00,0x00,0x00,0x0F,0x0F,0x00,0xF0,0xF8,0x0C,0x04,0x0C,0xF8,0xF0,0x00, // -O- 0x03,0x07,0x0C,0x08,0x0C,0x07,0x03,0x00,0x04,0xFC,0xFC,0x44,0x44,0x7C,0x38,0x00, // -P- 0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0xF8,0xFC,0x04,0x04,0x04,0xFC,0xF8,0x00, // -Q- 0x07,0x0F,0x08,0x0E,0x3C,0x3F,0x27,0x00,0x04,0xFC,0xFC,0x44,0xC4,0xFC,0x38,0x00, // -R- 0x08,0x0F,0x0F,0x00,0x00,0x0F,0x0F,0x00,0x18,0x3C,0x64,0x44,0xC4,0x9C,0x18,0x00, // -S-0x06,0x0E,0x08,0x08,0x08,0x0F,0x07,0x00,0x00,0x1C,0x0C,0xFC,0xFC,0x0C,0x1C,0x00, // -T- 0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0xFC,0xFC,0x00, // -U- 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00,0xFC,0xFC,0x00,0x00,0x00,0xFC,0xFC,0x00, // -V- 0x01,0x03,0x06,0x0C,0x06,0x03,0x01,0x00,0xFC,0xFC,0x00,0x80,0x00,0xFC,0xFC,0x00, // -W- 0x03,0x0F,0x0E,0x03,0x0E,0x0F,0x03,0x00,0x0C,0x3C,0xF0,0xC0,0xF0,0x3C,0x0C,0x00, // -X- 0x0C,0x0F,0x03,0x00,0x03,0x0F,0x0C,0x00,0x00,0x3C,0x7C,0xC0,0xC0,0x7C,0x3C,0x00, // -Y- 0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00,0x1C,0x0C,0x84,0xC4,0x64,0x3C,0x1C,0x00, // -Z- 0x0E,0x0F,0x09,0x08,0x08,0x0C,0x0E,0x00,0x00,0x00,0xFC,0xFC,0x04,0x04,0x00,0x00, // -[- 0x00,0x00,0x0F,0x0F,0x08,0x08,0x00,0x00,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00, // -\-0x00,0x00,0x00,0x01,0x03,0x07,0x0E,0x00,0x00,0x00,0x04,0x04,0xFC,0xFC,0x00,0x00, // -]- 0x00,0x00,0x08,0x08,0x0F,0x0F,0x00,0x00,0x08,0x0C,0x06,0x03,0x06,0x0C,0x08,0x00, // -^- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -_-0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x03,0x07,0x04,0x00,0x00,0x00, // -`-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xA0,0xA0,0xE0,0xC0,0x00,0x00, // -a- 0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0x00,0x04,0xFC,0xFC,0x20,0x60,0xC0,0x80,0x00, // -b- 0x08,0x0F,0x07,0x08,0x08,0x0F,0x07,0x00,0xC0,0xE0,0x20,0x20,0x20,0x60,0x40,0x00, // -c- 0x07,0x0F,0x08,0x08,0x08,0x0C,0x04,0x00,0x80,0xC0,0x60,0x24,0xFC,0xFC,0x00,0x00, // -d- 0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0x00,0xC0,0xE0,0xA0,0xA0,0xA0,0xE0,0xC0,0x00, // -e- 0x07,0x0F,0x08,0x08,0x08,0x0C,0x04,0x00,0x40,0xF8,0xFC,0x44,0x0C,0x18,0x00,0x00, // -f- 0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0xC0,0xE0,0x20,0x20,0xC0,0xE0,0x20,0x00, // -g- 0x27,0x6F,0x48,0x48,0x7F,0x3F,0x00,0x00,0x04,0xFC,0xFC,0x40,0x20,0xE0,0xC0,0x00, // -h- 0x08,0x0F,0x0F,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00,0x20,0xEC,0xEC,0x00,0x00,0x00, // -i- 0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xEC,0xEC,0x00, // -j- 0x00,0x30,0x70,0x40,0x40,0x7F,0x3F,0x00,0x04,0xFC,0xFC,0x80,0xC0,0x60,0x20,0x00, // -k- 0x08,0x0F,0x0F,0x01,0x03,0x0E,0x0C,0x00,0x00,0x00,0x04,0xFC,0xFC,0x00,0x00,0x00, // -l- 0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00,0xE0,0xE0,0x60,0xC0,0x60,0xE0,0xC0,0x00, // -m- 0x0F,0x0F,0x00,0x0F,0x00,0x0F,0x0F,0x00,0x20,0xE0,0xC0,0x20,0x20,0xE0,0xC0,0x00, // -n- 0x00,0x0F,0x0F,0x00,0x00,0x0F,0x0F,0x00,0xC0,0xE0,0x20,0x20,0x20,0xE0,0xC0,0x00, // -o- 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00,0x20,0xE0,0xC0,0x20,0x20,0xE0,0xC0,0x00, // -p- 0x40,0x7F,0x7F,0x48,0x08,0x0F,0x07,0x00,0xC0,0xE0,0x20,0x20,0xC0,0xE0,0x20,0x00, // -q- 0x07,0x0F,0x08,0x48,0x7F,0x7F,0x40,0x00,0x20,0xE0,0xC0,0x60,0x20,0x60,0xC0,0x00, // -r- 0x08,0x0F,0x0F,0x08,0x00,0x00,0x00,0x00,0x40,0xE0,0xA0,0x20,0x20,0x60,0x40,0x00, // -s- 0x04,0x0C,0x09,0x09,0x0B,0x0E,0x04,0x00,0x20,0x20,0xF8,0xFC,0x20,0x20,0x00,0x00, // -t-0x00,0x00,0x07,0x0F,0x08,0x0C,0x04,0x00,0xE0,0xE0,0x00,0x00,0xE0,0xE0,0x00,0x00, // -u- 0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0x00,0x00,0xE0,0xE0,0x00,0x00,0xE0,0xE0,0x00, // -v- 0x00,0x03,0x07,0x0C,0x0C,0x07,0x03,0x00,0xE0,0xE0,0x00,0x00,0x00,0xE0,0xE0,0x00, // -w-0x07,0x0F,0x0C,0x07,0x0C,0x0F,0x07,0x00,0x20,0x60,0xC0,0x80,0xC0,0x60,0x20,0x00, // -x-0x08,0x0C,0x07,0x03,0x07,0x0C,0x08,0x00,0xE0,0xE0,0x00,0x00,0x00,0xE0,0xE0,0x00, // -y-0x47,0x4F,0x48,0x48,0x68,0x3F,0x1F,0x00,0x60,0x60,0x20,0xA0,0xE0,0x60,0x20,0x00, // -z-0x0C,0x0E,0x0B,0x09,0x08,0x0C,0x0C,0x00,0x00,0x40,0x40,0xF8,0xBC,0x04,0x04,0x00, // -{-0x00,0x00,0x00,0x07,0x0F,0x08,0x08,0x00,0x00,0x00,0x00,0xBC,0xBC,0x00,0x00,0x00, // -|-0x00,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00,0x00,0x04,0x04,0xBC,0xF8,0x40,0x40,0x00, // -}-0x00,0x08,0x08,0x0F,0x07,0x00,0x00,0x00,0x08,0x0C,0x04,0x0C,0x08,0x0C,0x04,0x00, // -~-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x60,0x30,0x60,0xC0,0x80,0x00, // -•-0x07,0x07,0x04,0x04,0x04,0x07,0x07,0x00,};/***********************************************************/* 显示汉字的字模数组存储要测试的单词中文/* 纵向取模下高位16x16/* 下一个汉字为上一个汉字在数组中位置的hz1+32/*********************************************************/unsigned char code hz1[] ={/*-- 文字: 左--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x10,0x10,0x10,0x10,0x11,0x1E,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, 0x04,0x08,0x12,0x62,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x82,0x02,0x02,0x00, /*-- 文字: 鸟--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x00,0x00,0x3F,0x20,0x20,0x68,0xA6,0x20,0x22,0x21,0x3E,0x00,0x00,0x00,0x00, 0x00,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x4A,0x41,0x42,0x7C,0x00,0x00, /*-- 文字: 书--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x00,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x9F,0x40,0x20,0x00,0x00,0x00, 0x80,0x80,0x80,0x80,0x80,0x80,0xFF,0x80,0x80,0x80,0x84,0x82,0x84,0xF8,0x00,0x00,/*-- 文字: 树--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x08,0x09,0xFF,0x09,0x08,0x24,0x23,0x20,0x3F,0x00,0x09,0x08,0x08,0xFF,0x08,0x00, 0x60,0x80,0xFF,0x00,0x84,0x08,0x30,0xC0,0x38,0x00,0x00,0xC2,0x01,0xFE,0x00,0x00, /*-- 文字: 水--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x04,0x04,0x04,0x05,0x06,0x00,0xFF,0x06,0x01,0x02,0x04,0x18,0x00,0x00,0x00, 0x04,0x08,0x10,0x60,0x80,0x02,0x01,0xFE,0x00,0x80,0x40,0x20,0x10,0x08,0x08,0x00, /*-- 文字: 去--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x00,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 0x80,0x80,0x82,0x86,0x8A,0x92,0xE2,0x82,0x82,0x82,0x8A,0x86,0x83,0x80,0x80,0x00, /*-- 文字: 来--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x10,0x10,0x14,0x13,0x10,0x10,0xFF,0x10,0x10,0x11,0x16,0x10,0x10,0x00,0x00, 0x84,0x84,0x88,0x88,0x90,0xA0,0xC0,0xFF,0xC0,0xA0,0x90,0x88,0x88,0x84,0x84,0x00, /*-- 文字: 雨--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x40,0x47,0x44,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x44,0x47,0x40,0x00, 0x00,0xFF,0x00,0x00,0x90,0x48,0x00,0xFE,0x00,0x90,0x48,0x02,0x01,0xFE,0x00,0x00, /*-- 文字: 飞--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x02,0x05,0x08,0x10,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x84,0x42,0x0F,0x00, /*-- 文字: 吃--*//*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x3F,0x20,0x20,0x3F,0x04,0x08,0x32,0xD2,0x12,0x12,0x12,0x13,0x10,0x10,0x00, 0x00,0xF0,0x20,0x20,0xF0,0x00,0x0C,0x12,0x22,0x42,0x42,0x82,0x02,0x02,0x0E,0x00, };/*-----------------------------------------------------------*/#define LCD_OFF 0x3E#define LCD_ON 0x3F#define Add_X 0xB8 //the start address of the page 0 ;(0~7)#define Add_Y 0x40 //the start address of the Y counter ; (0~64)#define Add_Z 0xC0 //the start address of the DDRAM ; (0~64)/*-----------------------------------------------------------*/#define LCD12864_DATA_PORT P0sbit LCD12864_EN =P2^4;sbit LCD12864_RW =P2^3; //0:write ; 1:readsbit LCD12864_RS =P2^2; //0:the command .1:the datasbit LCD12864_CS_L =P2^1; //select the left of the lcd when 1sbit LCD12864_CS_R =P2^0;sbit LCD12864_RST =P2^5;/*------------------------------------------------------------*/void delayus(unsigned int us){while(us--);}void delayms(unsigned ms){unsigned int i,j;for (i=0;i<ms;i++){for (j=0;j<1000;j++);}}/*--------------------------select the LCD--------------------*/void LCDSel(unsigned char sel){switch(sel){case 0: LCD12864_CS_L=0;LCD12864_CS_R=0;break;case 1: LCD12864_CS_L=1;LCD12864_CS_R=0;break; //leftcase 2: LCD12864_CS_L=0;LCD12864_CS_R=1;break; //rightdefault:;};}/*------------------------------------------------------------*/void WaitLCD(){unsigned char flag;LCD12864_DATA_PORT=0xFF;LCD12864_RW=1;LCD12864_RS=0;LCD12864_EN=1;LCD12864_EN=1;LCD12864_EN=0;LCD12864_DATA_PORT=0xFF; //读有效数据LCD12864_RW=1;LCD12864_RS=0;;LCD12864_EN=1;do{flag=LCD12864_DA TA_PORT;LCD12864_DATA_PORT=0xFF;} while((flag&0x80)==1); //读BUSY信号//仅当第7位为0时才可操作LCD12864_EN=0;} //*//*-------------------------------------------------------------*/void WriteDatToLCD12864(unsigned char dat){WaitLCD();LCD12864_RS=1; //the dataLCD12864_RW=0; //writeLCD12864_DATA_PORT=dat;LCD12864_EN=1;;LCD12864_EN=0;}/*-------------------------------------------------------------*/void WriteCmdToLCD12864(unsigned char cmd){WaitLCD();LCD12864_RS=0; //the commandLCD12864_RW=0; //writeLCD12864_DATA_PORT=cmd;LCD12864_EN=1;;LCD12864_EN=0;}/*-------------------------------------------------------------*/unsigned char ReadDatFromLCD12864(void){unsigned char dat;WaitLCD();LCD12864_DATA_PORT=0xFF; //读空操作LCD12864_RS=1; //the dataLCD12864_RW=1; //readLCD12864_EN=1;LCD12864_EN=1;LCD12864_EN=0;LCD12864_DATA_PORT=0xFF; //来读有效数据LCD12864_RS=1; //the dataLCD12864_RW=1; //readLCD12864_EN=1;dat=LCD12864_DATA_PORT;LCD12864_EN=0;return dat;}/*--------------------------------------------------------------*///from the chip manualvoid LCD12864_init(void){LCD12864_RST=0;delayus(50);LCD12864_RST=1;LCDSel(0); //left and rightWriteCmdToLCD12864(LCD_OFF);WriteCmdToLCD12864(LCD_ON);}//x:0~7void SetX(unsigned char x) //写入X的地址{WriteCmdToLCD12864(Add_X+x);}//y:0~127void SetY(unsigned char y){WriteCmdToLCD12864(Add_Y+y);}//z:0~63void SetZ(unsigned char z){WriteCmdToLCD12864(Add_Z+z);}void ClearLCD(){int i,j;LCDSel(0);for(j=0;j<8;j++){WriteCmdToLCD12864(LCD_ON);SetX(j);WriteCmdToLCD12864(Add_Y); //diffrent from SetY(0),SetY(64);SetZ(0);for (i=0;i<64;i++){WriteDatToLCD12864(0x00);}}}/*-------------------------显示某点------------------*///左上角第一个点为原点,向下Y为轴,向右为X轴//x:0~63~127 y:0~63//flag : 0:擦除某个点// 1:显示某个点unsigned char code Tab[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};void Dot(char x,char y,bit flag){unsigned char dat;// y=63-y; //坐标轴的移动和反转if(x<64) //如果小于64则是在左半屏,CS1片选{LCDSel(1);SetX(y/8); //set the page addressSetY(x); //set the Y adressdat=ReadDatFromLCD12864();if(flag)dat=dat|(Tab[y%8]);elsedat=dat&(~(Tab[y%8])); //擦除某个点就是在原来的数据基础上与上(要擦的位置的取反)SetY(x); //set the Y adressWriteDatToLCD12864(dat);}else if(x<128){LCDSel(2);SetX(y/8);SetY(x-64);dat=ReadDatFromLCD12864();if(flag)dat=dat|(Tab[y%8]);elsedat=dat&(~(Tab[y%8]));SetY(x-64);WriteDatToLCD12864(dat);}}//draw a line between point(x1,y1) and point(x2,y2)//flag 0:erase the line 1:draw a linevoid Line(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2,bit flag){unsigned char i;unsigned char temp;float k;if(x1==x2){if(y1>y2){ temp=x1;x1=x2;x2=temp;temp=y1;y1=y2;y2=temp;}for(i=y1;i<=y2;i++){Dot(x1,i,flag);}}else{if(x1>x2){temp=x1;x1=x2;x2=temp;temp=y1;y1=y2;y2=temp;}k=(float)(y2-y1)/(float)(x2-x1);for(i=0;i<x2-x1;i++){Dot(x1+i,(unsigned char)(y1+k*i),flag);}}}/*-------------------------------------------------------------*/void Rect(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2,bit flag){Line(x1,y1,x2,y1,flag);Line(x2,y1,x2,y2,flag);Line(x2,y2,x1,y2,flag);Line(x1,y2,x1,y1,flag);}/*-------------------------------------------------------------*//*void RectArea(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2,bit flag) {unsigned char temp;unsigned char i;if(x1>x2){temp=x1;x1=x2;x2=temp;temp=y1;y1=y2;y2=temp;}for(i=0;i<=x2-x1;i++){Line(x1+i,y1,x1+i,y2,flag);}}//16*16//x行0~7 y列0~127//flag 0:汉字反白显示void hz_disp(unsigned char x,unsigned char y,unsigned char n,unsigned char code * hz,bit flag) {unsigned char i,j;for (j=0;j<n;j++){//显示上半个汉字for(i=0;i<16;i++){//点的位置是在左还是右if(y+16*j+i<64){LCDSel(1);WriteCmdToLCD12864(LCD_ON);SetX(x);SetZ(0);SetY(y+16*j+i);if(flag)WriteDatToLCD12864(hz[32*j+i]);elseWriteDatToLCD12864(~hz[32*j+i]);}else if(y+16*j+i<128){LCDSel(2);WriteCmdToLCD12864(LCD_ON);SetX(x);SetZ(0);SetY(y+16*j+i-64);if(flag)WriteDatToLCD12864(hz[32*j+i]);elseWriteDatToLCD12864(~hz[32*j+i]);}}//显示下半个汉字for(i=16;i<32;i++){//先判断点是在左还是在右if(y+16*j+i-16<64){ if(x+1<8) //最后一行显示上半个字{LCDSel(1);WriteCmdToLCD12864(LCD_ON);SetX(x+1);SetZ(0);SetY(y+16*j+i-16);if(flag)WriteDatToLCD12864(hz[32*j+i]);elseWriteDatToLCD12864(~hz[32*j+i]);}}else if(y+16*j+i-16<127){if(x+1<8) //最后一行{LCDSel(2);WriteCmdToLCD12864(LCD_ON);SetX(x+1);SetZ(0);SetY(y+16*j+i-16-64);if(flag)WriteDatToLCD12864(hz[32*j+i]);elseWriteDatToLCD12864(~hz[32*j+i]);}}}}}//x:行0~7//y:列0~127//asc: 指向标准交换码//string: 指向要显示的字符串//flag: 0 反白显示void en_disp(unsigned char x,unsigned char y,unsigned char n,unsigned char code *asc,unsigned char *string,bit flag){unsigned char i,j,loc;for (j=0;j<n;j++){loc=string[j]-0x20; //确定要显示的字符在asc表中的位置(乘上16),见字模ASC表,H头文件//显示上半个字母for(i=0;i<8;i++){//点的位置是在左还是右if(y+8*j+i<64){LCDSel(1);WriteCmdToLCD12864(LCD_ON);SetX(x);SetZ(0);SetY(y+8*j+i);if(flag)WriteDatToLCD12864(asc[16*loc+i]);elseWriteDatToLCD12864(~asc[16*loc+i]);}else if(y+8*j+i<128){LCDSel(2);WriteCmdToLCD12864(LCD_ON);SetX(x);SetZ(0);SetY(y+8*j+i-64);if(flag)WriteDatToLCD12864(asc[16*loc+i]);elseWriteDatToLCD12864(~asc[16*loc+i]);}}//显示下半个字母for(i=8;i<16;i++){//先判断点是在左还是在右if(y+8*j+i-8<64){if(x+1<8) //最后一行{LCDSel(1);WriteCmdToLCD12864(LCD_ON);SetX(x+1);SetZ(0);SetY(y+8*j+i-8);if(flag)WriteDatToLCD12864(asc[16*loc+i]);elseWriteDatToLCD12864(~asc[16*loc+i]);}}else if(y+8*j+i-8<128){if(x+1<8) //最后一行{LCDSel(2);WriteCmdToLCD12864(LCD_ON);SetX(x+1);SetZ(0);SetY(y+8*j+i-8-64);if(flag)WriteDatToLCD12864(asc[16*loc+i]);elseWriteDatToLCD12864(~asc[16*loc+i]);}}}}}/******************************** END ************************************/。
基于单片机的单词记忆测试器

基于单片机的单词记忆测试器目录第一章单词记忆测试器的设计 (2)1.1 硬件模块设计 (2)1.1.1中央处理模块 (2)1.1.2 显示模块的硬件部分介绍 (3)1.1.3 矩阵键盘 (6)1.2 电路原理图设计 (6)1.3 软件程序设计 (8)1.3.1 程序设计思路 (8)1.3.2矩阵键盘的程序设计 (8)1.3.3 LCD12864显示模块的驱动程序 (9)1.3.4 显示字模码的提取 (11)1.3 系统软件主程序结构及其函数 (12)1.4 软件的仿真 (17)第二章结语 (19)附录单片机单词记忆测试器C程序源代码基于单片机的单词记忆测试器摘要本论文的研究对象是基于单片机的单词记忆测试器的设计,此单词记忆测试器可以实现单词的输入并判断输入的单词是否正确,单词背完后给出正确率。
该单片机单词记忆测试器为在现实生活中有着广泛的应用,特别是对学习英语方面有很大的作用。
本设计以STC89C52单片机为处理器,以12854点阵液晶屏为显示器件,并使用5×6距阵键盘为输入设备,实现了功能全面的人机界面和高速的数据处理功能,利用单片机片上FLASH ROM,可储存10-20个英文单词和汉字,作为记忆测试用。
关键词:单片机单词记忆测试器 AT89C52 12864液晶屏第一章 单词记忆测试器的设计1.1 硬件模块设计本单词记忆测试器系统硬件部分分为三个模块:中央处理模块、显示模块、键盘输入模块。
系统模型图如下:图4 系统硬件模块图1.1.1中央处理模块中央处理模块选用STC89C52单片机系统组成,电路包括:STC89C52单片机、复位电路、时钟振荡电路。
STC89C52单片机需在复位电路和时钟振荡电路组成的最小系统下工作,单片机引脚图如图5,外围电路如图6和图7所示,时钟电路采用频率采用为12MHZ 的晶振,C1、C2与晶振构成了外部振荡电路。
复位电路采用电解电容与电阻串联,当系统上电时,由于电容充电,在RST 端会产生一个高电平,高电平持续的时间由电容和电阻的值决定,当RESET 信号为低电平时,系统为工作状态。
基于Android的背单词软件设计与实现计算机毕业论文

毕业论文论文题目:基于Android的背单词软件的设计与实现姓名:学号:班级:专业:软件工程学院:软件学院指导老师:完成时间:2015年4月17日基于Android的背单词软件的设计与实现摘要随着经济全球化,我们与外国人的接触越来越多,英语已经成为了中国与外面交流的主要工具,同时我国的英语教育也开始普及到了小学,人们对学习英语越来越重视。
而对于学习英语特别是英语单词记忆,记忆单词的方式也在不断的更新,而今移动互联网时代的到来,尤其智能手机的广泛应用,英语学习的平台已经逐渐向计算机或者手机等移动设备上转移,背单词的方式方法进入一个新的领域。
背单词软件是当下比较流行且方便有效的辅助记忆工具,本文介绍的背单词软件是一款基于android平台的应用软件,其主要功能有单词学习,单词背诵,单词测试,真人发音,添加生词本等。
同时本文对背单词软件开发中有关系统设计,系统实施方法和设计词库等方面进行了探索,以此推动计算机英语辅助软件开发。
关键词:Android;背单词;英文学习;软件开发Design and implementation of memorizing word software based onAndroidAbstractWith the economic globalization,we contact with foreigners more and more, English has become the main tool to communicate with foreign in China,English education in our country also started to popularize the primary school,people pay more and more attention to learning English.For learning English especially in English words memory,memorize words way are also constantly updated,but now the advent of the era of mobile Internet,especially the wide application of smart phones,English learning platform has been gradually shift to computer or on mobile devices such as mobile phones,methods of memorizing words into a new field.Memorizing words software is now more popular and convenient and effective tool of memory,crouching tiger word software is introduced in this paper a based on android platform of application software,its main function is the word study, recite words, word test, pronunciation, to add the new words and so on.At the same time in this paper, the back word software development related to system design, system implementation methods and designs thesaurus has explored in such aspects,to promote English computer auxiliary software development.Key words: Android; recite words; English study; software development目录摘要 (I)Abstract (II)1. 绪论 (1)1.1研究内容 (1)1.2研究意义 (1)1.3研究现状和发展趋势 (1)2. 平台与开发工具 (3)2.1 开发平台介绍 (3)2.2 开发语言与开发环境 (3)3. 英语背单词软件总体设计与需求分析 (5)3.1 Android四大组件简介 (5)3.2 Android 手机应用软件的UI设计 (6)3.3 英语背单词软件需求分析与性能分析 (7)3.4 英语背单词软件操作流程图与数据库设计 (8)3.4.1 英语背单词软件操作流程图 (8)3.4.2 数据库的创建与设计 (8)4. 系统各个模块的具体实现 (14)4.1 启动模块的实现 (14)4.2 用户信息模块的实现 (15)4.3 用户单词学习模块的实现 (17)4.4 用户单词复习模块的实现 (19)4.5 用户单词测试模块的实现 (20)4.6 生词本模块的实现 (21)4.7 各界面之间切换的实现 (23)5. 客户端界面测试 (24)5.1 系统测试的目标 (24)5.2 测试流程 (24)5.3 测试用例与测试结果 (24)6. 总结 (25)6.1 本文工作总结 (25)6.2 进一步工作的打算 (25)参考文献 (26)致谢 (27)外文原文 (28)外文翻译 (44)1. 绪论1.1研究内容本着对用户学习英语提供便利和有效记忆的目标,该英语背单词软件是基于Android手机平台,通过词库的解析与导入,开发出针对使用Android平台的手机英语背单词系统。
单片机课程设计记忆训练器设计

摘要现如今单片机在电子设计领域应用相当的广泛,因此基于单片机的设计对我们来说越来越有实际意义。
在硬件方面,此课程设计主要是以单片机为主体,附加其他的一些元器件,再通过一定的编程语言编程实现特定的记忆训练功能。
此次课设通过人为按键的输入,将键值转送到单片机,在单片机中进行判断处理后,通过数码管显示出来,为了能过大量的存储数据,采用SRAM6264芯片作为外部数据存储器,同时以74LS373作为锁存器。
单片机采用按键电平复位电路和并接12MHz晶体震荡器、两只电容器(30pF)的振荡电路。
在软件方面,整个程序包含了一个主程序与四个子程序:1位数的显示子程序“P1XS”、4键输入子程序“KEY4”、比较子程序“BJ”、延时子程序DELAY。
关键词:单片机、按键、显示、编程目录1、课程设计内容及实现功能 (3)1.1、课设内容 (3)1.2、课设功能 (3)2、课程设计总体设计方案 (4)2.1、电路设计方案 (4)2.2、整体电路系统设计框图 (5)3、硬件设计 (5)3.1、显示电路 (5)3.1.1、数码管简介 (6)3.2、复位电路 (7)3.3、时钟电路 (9)3.4、按键控制电路 (10)3. 5、数据存储器扩展电路 (11)3.5.1、74LS373性能简述 (12)3.5.2、89C51单片机功能介绍 (15)3.5.3、SRAM6264简要描述 (18)4、软件设计 (20)4.1、程序流程图 (20)4.2、记忆训练器程序 (22)5、检测与调试 (25)5.1、硬件调试 (25)5.2、软件调试 (26)6、心得体会 (26)附录 (27)1、记忆训练器PCB图 (27)2、元器件清单 (27)3、参考文献 (28)1、课程设计内容及实现功能1.1、课设内容此次课程设计要求我们熟练运用单片机、模电及数电等知识设计一个电路。
此课程设计是用扩展外部存储器方式设计一个记忆训练器。
为了能够存储大量的数据,扩展外部数据存储器采用SRAM6264实现1.2、课设功能本课设的具体功能及操作步骤如下:(1)开机后显示“一”,按下“1”键后训练测试过程开始;(2)单片机随机产生一个1~4中的数(如“3”);(3)使用者按下相应的数字键(“3”);(4)单片机又产生一个随机数,并通过LED显示器显示出来(如“2”);(5)使用者要按之前出现的数字顺序按下相应的数字键(“3、2”);(6)又显示一个随机数(如“4”);(7)重复步骤(5)的操作。
基于单片机的单词记忆测试器设计

基于单片机的单词记忆测试器设计
设计一个基于单片机的单词记忆测试器可以包括以下功能:
1.单词输入功能:设计一个键盘或触摸屏,允许用户输入需要记忆的单词。
用户可以使用字母键盘或者屏幕上的虚拟键盘进行输入。
2.单词存储功能:使用单片机的内部存储器或外部存储器,将用户输入的单词进行存储。
可以使用数组或者链表等数据结构来进行存储。
3.单词显示功能:在屏幕上显示需要记忆的单词。
可以使用LCD屏幕或者其他显示设备来显示单词。
4.记忆测试功能:设计一个定时器,在指定的时间间隔后,显示存储的单词。
用户需要根据记忆进行选择,是否能正确地回忆出之前输入存储的单词。
5.记忆结果反馈功能:根据用户的选择结果,给出相应的反馈。
如果用户选择正确,可以在屏幕上显示“正确”;如果选择错误,可以在屏幕上显示“错误”并显示正确答案。
6.重复记忆功能:如果用户选择错误,可以设置继续记忆该单词,直到选择正确为止。
7.总记忆测试结果统计功能:记录并统计用户的记忆测试结果,包括记忆测试次数、正确率等信息。
8.设置功能:提供用户设置记忆测试的参数,如记忆时间间隔、测试次数等。
以上是一个简单的基于单片机的单词记忆测试器设计方案,具体的实现方式可以根据实际需求和使用的单片机型号进行调整。
一种基于PIC单片机的便携式磁记忆检测仪.

一种基于PIC单片机的便携式磁记忆检测仪引言金属构件和零部件发生损坏的主要原因,是各种微观和宏观机械应力集中导致疲劳失效,其基本特征表现为材料在低于静强度极限的交变应力持续作用下,生成多种类型的微观内部缺陷,并逐渐演化为宏观裂纹,裂纹扩展最终导致结构破坏。
因此,进行疲劳分析,有效评价应力变形状况,测定未来裂缝发展的位置、大小和方向,成为评价金属零部件与构件结构强度和可靠性的一个重要依据。
为了及时准确的找出最大机械应力变形区域,20引言金属构件和零部件发生损坏的主要原因,是各种微观和宏观机械应力集中导致疲劳失效,其基本特征表现为材料在低于静强度极限的交变应力持续作用下,生成多种类型的微观内部缺陷,并逐渐演化为宏观裂纹,裂纹扩展最终导致结构破坏。
因此,进行疲劳分析,有效评价应力变形状况,测定未来裂缝发展的位置、大小和方向,成为评价金属零部件与构件结构强度和可靠性的一个重要依据。
为了及时准确的找出最大机械应力变形区域,20世纪90年代后期,以杜波夫为代表的俄罗斯学者率先提出一种崭新的诊断技术—金属磁记忆检测。
本文采用PIC单片机,设计了高性价比的便携式磁记忆检测仪,具有低成本、低功耗和快速检测等特点,可以满足各种场合,特别是难以到达部位的应力集中区检测。
磁记忆检测铁磁学研究表明,当弹性应力作用于铁磁材料时,铁磁体不但会产生弹性应变,还会产生磁致伸缩性质的应变,改变其自发磁化的方向,这就是磁弹性效应。
根据“实际存在的状态必定是能量最小的状态”原则,由于磁机械效应的作用引起工件内部的磁畴重新取向排列,以增加磁弹性能的形式来抵消应力能的增加,结果在铁磁工件内部产生的磁场强度将高于地球磁场强度,在应力集中区,形成类似缺陷的漏磁场分布形式,磁场的切向分量Hp(x)为最大值,而法向分量Hp(y)在应力集中线两侧符号发生变化,应力集中线处有过零点。
磁记忆检测技术,是基于磁记忆效应原理的全新无损检测方式。
磁记忆检测技术在地磁环境下,通过对铁磁材料所制成的工件表面散射磁场法向分量Hp(y)的测量,确定工件应力集中区域,从而有效预测缺陷发生的区域。
基于单片机的计算器设计毕业设计+外文文献翻译

摘要计算器一般是指“电子计算器”,能进行数学运算的手持机器,拥有集成电路芯片,结构简单,功能较弱,但由于它使用方便、操作简单、价格低廉,因而广泛运用于商业交易中,也是必备的办公用品。
近年来随着科技的飞速发展,单片机的应用正在不断深入,同时带动传统控制检测技术日益更新。
在实时检测和自动控制的单片机应用系统中,单片机往往作为一个核心部件来使用,但仅单片机方面的知识是不够的,还应根据具体硬件结构、软硬件结合,来加以完善。
因此,单片机的应用已经越来越贴近生活,用单片机来实现一些电子设计也变得容易起来。
计算器在人们的日常中是比较的常见的电子产品之一。
可是它还在发展之中,以后必将出现功能更加强大的计算器,基于这样的理念,本次设计是用单片机来设计的计算器。
该设计系统是以AT89S52 为单片机,P1 口作为输入端,外接4X4 的键盘。
通过键盘扫描来对输入数的控制,在P0 口、P2 口接了驱动电路,用来保证LCD 的工作正常。
计算器将完成的功能有加,减,乘,除等功能。
关键词:计算器;单片机;LCD;矩阵键盘ABSTRACTCalculator generally refers to the electronic calculator, and the term is introduced to China by the Japanese. The calculator with the IC chip, simple structure, and weak function is able to perform mathematical operations on handheld machine. But it is easy using, simple operation and low price. So it is widely used in commercial transactions, and is also an essential office supplies.With the rapid development of science and technology in recent years, the application of SCM is the deepening and promote the traditional controlling detection technologies that are increasingly updated. In real-time detection and automatic control of microcomputer application system, the microcontroller is often used as a core component to use, but only the knowledge of the microcontroller is not enough, and should be based on the specific hardware architecture, hardware and software combination to make it perfect. So the application of SCM is more and more close to life, so using of single chip to achieve some electronic designs also become easy. In the people daily life the calculator is one of the common electronic products. But it is still in development, it will become more powerful calculator in the future. According to such idea, the design is that SCM design calculator. The design system is based on AT89S52 microcontroller, P0 port as input, external 4X4 keyboard. In P1, P2mouth is connected with the drive circuit to ensure the normal work of LED. The calculator will complete add, subtract, multiply, divide and other function.Keywords: calculator, MCU, LCD, Matrix keyboard前言计算器(calculator;counter)一般是指“电子计算器”,能进行数学运算的手持机器,拥有集成电路芯片,结构简单,功能较弱,但由于它使用方便、操作简单、价格低廉,因而广泛运用于商业交易中,也是必备的办公用品之一。
基于单片机的单词记忆测试器设计de开题报告、任务书

附件9:武汉长江工商学院本科毕业论文(设计)任务书论文名称:基于单片机的单词记忆测试器设计系、专业:电子信息工程学生姓名:指导教师:下达时间:2011-12一、论文(设计)的选题意义随着经济的发展,科技的突飞猛进,芯片技术也取得了飞速发展,使单片机技术在各种民用和工业测控等领域得到了更为广泛的应用。
单片机凭借其低成本、高性能的不可替代优势,已经成为微电脑控制的主力军。
据统计,我国的单片机年需求量已达2亿片以上,且每年以大约15%的速度增长,发展迅速的单片机行业有着广阔的前景。
相比于发展迅猛的单片机行业,国内的单片机设计开发从业人员缺口很大。
据统计,到2015年,我国单片机开发从业人员将达350万人,而目前的从业者大约只有一百五十万人,两百万的人才缺口正驱动着大量的人员加入这个庞大的群体。
目前,一个学习与应用单片机的高潮正在工厂、学校及企事业单位大规模地兴起。
学习单片机的最有效方法就是理论与实践并重,因此通过单片机对单词记忆测试器的设计和研究,对于切实掌握单片机相关知识具有重要的理论和实际意义。
现在,社会越来越多重视英语的学习,单词的记忆很大程度上决定了英语成绩的好坏。
因此,很多家长会给自己的孩子购买一个记忆单词的工具,目前这类产品在市场上层出不穷。
这些产品都有一个共同的特点:都是以单片机为基础演变开发而来。
因此,以单片机为基础设计单词记忆测试器很基础,同时对切实掌握单片机相关知识具有重要的理论和实际意义。
二、论文(设计)的任务和基本要求(1)实现单词的录入(为使程序具有可演示性,单词不少于10个);(2)单词用按键控制依次在屏幕上显示,按键选择认识还是不认识,也可以直接进入下一个或者上一个;(3)单词背完后给出正确率;(4)使用Proteus软件仿真电路原理图;(5)使用Keil软件编译程序。
三、论文(设计)的进程安排2011.12.10~2012.2.29 明确设计题目的任务要求,并完成开题报告2012.3.1~2012.3.10 熟悉课题背景,查阅和学习相关资料2012.3.10~2012.3.31 完成主要工序要求的程序顺序功能图2012.4.1~2012.4.20 实际调试,测试仿真过程中可能存在的问题,并查找书籍并及时与指导老师沟通解决相关问题。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
基于单片机的单词记忆测试器毕业设计基于单片机的单词记忆测试器毕业设计基于单片机的单词记忆测试器基于单片机的单词记忆测试器毕业设计目录第一章单词记忆测试器的设计............................................................... .................... 2 硬件模块设计............................................................... ................................. 2 中央处理模块............................................................... ......................... 2 显示模块的硬件部分介绍............................................................... ....... 3 矩阵键盘............................................................... ............................... 7 电路原理图设计............................................................... ............................... 7 软件程序设计............................................................... .................................. 9 程序设计思路............................................................... ......................... 9 矩阵键盘的程序设计............................................................... ............... 9 LCD12864显示模块的驱动程序...........................................................10 显示字模码的提取............................................................... ............... 12 系统软件主程序结构及其函数............................................................... ........ 14 软件的仿真............................................................... .................................. 21 第二章结语............................................................... .............................................. 23 附录单片机单词记忆测试器C程序源代码基于单片机的单词记忆测试器摘要本论文的研究对象是基于单片机的单词记忆测试器的设计,此单词记忆测试器可以实现单词的输入并判断输入的单词是否正确,单词背完后给出正确率。
该单片机单词记忆测试器为在现实生活中有着广泛的应用,特别是对学习英语方面有很大的作用。
本设计以STC89C52单片机为处理器,以12854点阵液晶屏为显示器件,并使用5×6距阵键盘为输入设备,实现了功能全面的人机界面和高速的数据处理功能,利用单片机片上FLASH ROM,可储存10-20个英文单词和汉字,作为记忆测试用。
关键词:单片机单词记忆测试器AT89C5212864液晶屏第一章单词记忆测试器的设计硬件模块设计本单词记忆测试器系统硬件部分分为三个模块:中央处理模块、显示模块、键盘输入模块。
系统模型图如下:5×6矩阵键盘模块单片机中央处理模块LCD12864液晶显示模块图4 系统硬件模块图中央处理模块中央处理模块选用STC89C52单片机系统组成,电路包括:STC89C52单片机、复位电路、时钟振荡电路。
STC89C52单片机需在复位电路和时钟振荡电路组成的最小系统下工作,单片机引脚图如图5,外围电路如图6和图7所示,时钟电路采用频率采用为12MHZ 的晶振,C1、C2与晶振构成了外部振荡电路。
复位电路采用电解电容与电阻串联,当系统上电时,于电容充电,在RST 端会产生一个高电平,高电平持续的时间电容和电阻的值决定,当RESET信号为低电平时,系统为工作状态。
STC89C52具有ISP的功能,可以通过串行口直接将程序下载到单片机内。
在下载程序状态下,RESET信号被拉高,系统进行程序下载,待程序下载完毕后,RESET重新拉低。
用户可以通过切断电源进行手动复位,或者通过重新下载新的程序进行复位。
图 5 STC89C52的引脚排列图图6 时钟电路图图7复位电路图显示模块的硬件部分介绍显示模块采用单色点阵液晶屏12864模块,该模块在点阵液晶屏基础上集成了控制器kS0108,用户只需设计好接口程序,就可让模块显示出各种字符和图像。
通常我们所见到的LCD 模块,分为几部分:LCM、背光、PCB 板;而背光和PCB板部分其实是可有可无的,视具体的LCD 模块而定。
点阵的LCD 模块按照驱动控制器的集成方式,大可分为两种:COB 和COG;COG 其实就是将驱动控制IC 集成到了玻璃里面,这样的而后面的PCB 板上其实只是一些驱动控制IC 无法集成的电容电阻而已;COB 也就是把驱动控制IC 焊接在LCD 模块后面的PCB 板上。
12864 为一块128X64 点阵的LCD 显示模块,模块上的LCM 采用COG 技术将控制、驱动器集成在LCM 的玻璃上,接口简单、操作方便;为方便用户的使用,在LCM 的基础上设计了12864 模块,将模块所必需的外围电容电阻集成到模块上,并引出多种形式的引线接口方便用户使用。
12864 模块与各种MCU 均可进行方便简单的接口操作。
LCD 的接口:一般来说,LCD 模块的接口多为总线的接口,不是6800 就是8080,或者是串行SPI;除了这些总线的端口外,有的LCD 模块还引出了一些功能性的端口,如偏压调节输入、负压输出等。
图8 12864 模块接口定义表显示RAM 区映射情况:对于LCD 模块,了解清楚驱动控制IC 当中的显存与LCD 玻璃上的点的对应关系是非常重要的,这是编写LCD 的驱动程序的基础。
12864 液晶显示模块的显示器上的显示点与驱动控制芯片中的显示缓存RAM是一一对应的;驱动控制芯片当中共有65X 132 个位的显示RAM 区。
而显示器的显示点阵大小为64X128 点,所以实际上在液晶显示模块中有用的显示RAM 区为64 X 128 个位;按byte 为单位划分,共分为8 个Page,每个Page 为8 行,而每一行为128 个位。
驱动控制芯片的显示RAM区每个byte的数据对应屏上的点的排列方式为:纵向排列,低位在上高位在下;如图8所示图8 驱动控制芯片的显示RAM区12864 液晶显示模块的显示屏上的每一个点都对应有控制器片内的显示缓存RAM中的一个位,显示屏上64X128 个点分别对应着显示RAM的8 个Page,每一个Page有128 个byte的空间对应。
因此可知显示RAM区中的一个Page空间对应8 行的点,而该Page 中的一个byte数据则对应一列。
图9 为显示RAM区与显示屏的点映射图:图9 显示RAM区与显示屏的点映射图行、列地址:用户如要点亮LCD 屏上的某一个点时,实际上就是对该点所对应的显示RAM 区中的某一个位进行置1 操作;所以就要确定该点所处的行地址、列地址。
从上图中可以看出,MzL02-12864 液晶显示模组的行地址实际上就是Page 的信息,每一个Page 应有8 行;而列地址则表示该点的横坐标,在屏上为从左到右排列,Page 中的一个Byte 对应的是一列,达128 列。
可以根据这样的关系在程序中控制LCD 显示屏的显示。
注意:MzL02-12864 的显示缓存RAM 区实际上比模块上的显示器所对应的RAM 区要大;而LCD 模块具体设置Page时,屏上的位置与驱动控制IC 当中的哪里的RAM区对应,还与驱动控制IC 与屏的连接有关;所以,实际在使用时,请参考所提供的范例设置。
矩阵键盘要测试记忆的单词,就要有字母的输入接口,本接口设计为5×6矩阵键盘输入,接入单片机的P1口和P3口进行键盘扫描。
最大程度地提高了单片机IO口的利用率,设计共30个接键,包括了26个英文字母以及四个功能键:“确定”、“不认识”、“上一个”、“下一个”。
矩阵键盘如图10,30个轻触按键按照6行5列排列,连接到P1、P3端口。
其扫描的原理是:先将行线所接的单片机的I/O口作为输出端,而列线所接的I/O口则作为输入。
这样,当按键没有按下时,所有的输出端都是高电平,代表无键按下。
行线输出是低电平,一旦有键按下,则输入线就会被拉低,这样,通过读入输入线的状态就可得知是否有键按下了。
然后再将行线所接的单片机的I/O口作为输入端,而列线所接的I/O口则作为输出,以相同的方法读一次端口,程序中就可识别是啊个坐标的按键按下了。
图10 5×6矩阵键盘电路原理图设计电路原理图设计使用集原理图设计、PCB设计、电路仿真功能为一体的PROTUES软件。
以该软件设计的电路原理图图11。
图11 单片机单词记忆测试器电路原理图电路设计参数:C1 C2 为20-30PF 瓷片电容,与12M晶振组成时钟振荡电路;复位电路使用R1为10K电阻、C3为10uF电解电容;12864液晶模块与单片机P0口连接,因P0口为真正的三态门结构,因些作数据总线使用时要外接上拉电阻,可使用10K的排阻;按键如图的行相连,列相连的矩阵接法连入单片机IO口;电路的供电为5V直流电源;D1为输入错误的状态指示灯,加220欧限流电阻连到VCC,因为STC89C51单片机IO的电流灌入能力要强于电流输出能力,因此一般使IO为低电平时点亮LED灯。
软件程序设计程序设计思路因本系统为模块化设计,为方便软件编写和移植,程序设计采用C 语言,程序流程图如下:矩阵键盘的程序设计单片机初始化矩阵键盘采用5×6 列与行扫描法,P1口依次接键盘的每一行,而P3口依次接键盘的每一列,程序开始先令P1全为高电平,P3口全为低电平,这样一LCD12864初始化旦矩阵键盘中有一个键按下时,就会在某一行中出现低电平,而某一列中出现高电平,程序先读P1口,以检测到有低电平来确定行。