首页 毕业设计(论文)-VC编程软件来开发上位机与下位机之间通信编程 (2)(1)

毕业设计(论文)-VC编程软件来开发上位机与下位机之间通信编程 (2)(1)

举报
开通vip

毕业设计(论文)-VC编程软件来开发上位机与下位机之间通信编程 (2)(1)毕业设计(论文)-VC编程软件来开发上位机与下位机之间通信编程 (2)(1) 摘 要 本文主要描述了利用PC机与AT89C51单片机之间的通信程序设计实现温度显示。并详述了在VC6.0环境下,上位机利用MSCOMM通信控件与单片机之间串口通信实现温度显示。由单片机采集一个温度信号,将采集到的温度信号传送给PC机显示,PC机用VC6.0编写程序,单片机程序用C语言编写,最后用PROTUES软件进行仿真实现温度显示。 关键词:单片机 MSCOMM控件 VC6.0 AT89C51 温度显示 their own c...

毕业设计(论文)-VC编程软件来开发上位机与下位机之间通信编程 (2)(1)
毕业设计(论文)-VC编程软件来开发上位机与下位机之间通信编程 (2)(1) 摘 要 本文主要描述了利用PC机与AT89C51单片机之间的通信程序设计实现温度显示。并详述了在VC6.0环境下,上位机利用MSCOMM通信控件与单片机之间串口通信实现温度显示。由单片机采集一个温度信号,将采集到的温度信号传送给PC机显示,PC机用VC6.0编写程序,单片机程序用C语言编写,最后用PROTUES软件进行仿真实现温度显示。 关键词:单片机 MSCOMM控件 VC6.0 AT89C51 温度显示 their own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorously promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performance, enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, market influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking business road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) to promote the integration of resources. To further broaden their horizons, effective integration of resources within the group, the city resources, other industries and regional resources, mutual trust, mutual benefit, seeking win-win principle, in the framework of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval procedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve leveraging the development, ensure that the value of state-owned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training of cadres and workers of the existing business, firmly establish the concept of the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to respond to market competition, improve management and operation of the market. At the same time, according to the need of industrial development, vigorously the introduction of high-quality management management personnel, and strive to build a high-quality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structure optimization and upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy for policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, especially the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek policy, projects and funds, enterprise and industry group mission to promote leapfrog development. 目 录 摘要 1 引言............................................................................................................................ 1 2 结构设计与方案选择................................................................................................ 2 2.1设计任务........................................................................................................... 2 2.1.1单片机的选择.......................................................................................... 2 2.1.2电平转换.................................................................................................. 2 2.1.1单片机的选择.......................................................................................... 2 2.1.3单片机与pc机通信原理 ........................................................................ 2 2.2软件方案选择................................................................................................... 2 2.2.1 上位机编程方案选择............................................................................. 3 2.2.2 单片机编程方案选择............................................................................. 3 2.3 总体方案选择.................................................................................................. 2 3 硬件设计.................................................................................................................... 8 3.1单片机主要特性............................................................................................... 5 3.2 MAX232电平芯片介绍10 ........................................................................... 10 3.3 硬件电路设计图............................................................................................ 11 3.3.1 PC机与单片机通信接口电路设计框图.............................................. 11 3.3.2整体设计原理图.................................................................................... 11 4 软件设计.................................................................................................................. 12 4.1上位机程序设计............................................................................................. 12 4.2下位机程序设计............................................................................................. 13 5 软硬件调试部分...................................................................................................... 21 5.1 PROTEUS软件仿真 ...................................................................................... 21 5.1.1 Protues简介........................................................................................... 21 5.1.2 Protues仿真电路图............................................................................... 22 5.2 VC软件仿真 .................................................................................................. 21 结束语..........................................................................................................................27 致谢..............................................................................................................................28 参考文献......................................................................................................................29 -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous2icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training 1引言 随着人们生活水平的不断提高,单片机控制无疑是人们追求的目标之一,它所给人带来的方便也是不可否定的,要为现代人工作、科研、生活、提供更好的更方便的设施就需要从单片机技术入手,一切向着数字化控制,智能化控制方向发展。 现代化集中管理需要对现场数据进行统计、 分析 定性数据统计分析pdf销售业绩分析模板建筑结构震害分析销售进度分析表京东商城竞争战略分析 、制表、打印、绘图、报警等,同时,又要求对现场装置进行实时控制,完成各种规定操作,达到集中管理的目的。加之单片机的计算能力有限,难以进行复杂的数据处理。因此在功能比较复杂的控制系统中,通常以PC机为上位机,单片机为下位机,由单片机完成数据的采集及对装置的控制,而由上位机完成各种复杂的数据处理及对单片机的控制。 1 2方案选择 2.1硬件方案选择 2.1.1单片机的选择 本设计采用的是AT89C51单片机,AT89C51是一种带4K字节闪存可编程可擦除只读存储器(FPEROM—Flash Programmable and Erasable Read Only Memory)的低电压、高性能CMOS 8位微处理器,俗称单片机。它是一种高效微控制器,因为它更经济实惠,用起来灵活方便,而且习惯了用这种型号的单片机,所以选择AT89C51单片机。 2.1.2电平转换 本设计采用MAX232芯片进行电平转换,MAX232芯片是美信公司专门为电脑的RS232 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 串口设计的接口电路,使用+5V单电源供电,它的作用就是完成TTL电平与RS232电平的转换。PC机的串行口采用的是标准的RS 232接口,单片机的串行口电平是FTL电平,而TTL电平特性与RS 232的电气特性不匹配,因此为了使单片机的串行口能与RS 232接口通信,必须将串行口的输入/输出电平进行转换。通常用MAX232芯片来完成电平转换。 2.1.3单片机与pc机通信原理 MCS-51单片机有一个全双工的串行通讯口UART。利用其RXD和TXD与外界进行通信,其内部有2个物理上完全独立的接收、发送缓冲器SBUF,可同时发送和接收数据。所以单片机和PC机之间可以方便地进行串口通讯。单片机串口有3条引线:TXD(发送数据)、RXD(接收数据)和GND(信号地)。因此在通信距离较短时可采用零MO? DEM方式,简单三连线结构。IBM—PC机有两个标准的RS(232串行口,其电平采用的是EIA电平,而MCS-51单片机的串行通信是由TXD(发送数据)和 RXD(接收数据)来进行全双工通信的,它们的电平是TTL电平;为了Pc机与MCS-51机之间能可靠地进行串行通信,需要用电平转换芯片,我们采用了MAXIM公司生产的专用芯片MAX232进行转换。电路如图所示。 l deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous2icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of high 图2.2 MAX232工作原理图 2.2软件方案选择 2.2.1 上位机编程方案选择 本设计采用VC6.0++来实现编程,上位机与单片机进行通信的程序编写可用VB、VC等软件。由于VB作为面向对象的编程工具不够完全,效率比VC低,提供的命令语言环境较弱,通过串口设备一次最多只能交换16B的数据,对较大数据量的传输存在很大的局限性,很难实现较为复杂的数据处理,VC6.0++是一种功能强大的面向对象的Windows编程开发平台。VC6.0的优点是界面简洁,占用资源少,操作方便。所以本设计采用VC作为串口编程工具。 2.2.2 单片机编程方案选择 本设计单片机的编程选择C语言编写,因为它简洁紧凑、灵活方便、运算符丰富、数据结构丰富、C是结构式语言、C语法限制不太严格,程序设计自由度大、C语言允许直接访问物理地址,可以直接对硬件进行操作、C语言程序生成代码质量高,程序执行效率高,一般只比汇编程序生成的目标代码效率低10へ20%、C语言适用范围大,可移植性好C语言有一个突出的优点就是适合于多种操作系统, 如DOS、UNIX,也适用于多种机型。C语言具有绘图能力强,可移植性,并具备很强的数据处理能力,因此适于编写系统软件,三维,二维图形和动画它是数值计算的高级语言。所以我选用C语言来编写此程序。 2.3 总体方案选择 3 温度传感器测量出来的温度值由单片机采集出来,然后单片机再将采集出的温度数据处理后,通过串行口发送给上位机。 AT89C51PC机 MAX232 11 图2.1总体设计方案流程图 of cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous4icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to respon 3硬件设计 3.1 单片机主要特性 ?与MCS-51 兼容 ?4K字节可编程闪烁存储器 ?寿命:1000写/擦循环 ?数据保留时间:10年 ?全静态工作:0Hz-24MHz ?三级程序存储器锁定 ?128?8位内部RAM ?32可编程I/O线 ?两个16位定时器/计数器 ?5个中断源 ?可编程串行通道 ?低功耗的闲置和掉电模式 ?片内振荡器和时钟电路 单片机AT89C51的引脚说明: 图3.1 AT89C51的引脚排列 引脚描述: VCC:电源电压 5 GND:地 P0口:P0口是一组8位漏极开路双向I/O口,即地址/数据总线复用口。作为输出口时,每一个管脚都能够驱动8个TTL电路。当“1”被写入P0口时,每个管脚都能够作为高阻抗输入端。P0口还能够在访问外部数据存储器或程序存储器时,转换地址和数据总线复用,并在这时激活内部的上拉电阻。P0口在闪烁编程时,P0口接收指令,在程序校验时,输出指令,需要接电阻。 P1口:P1口一个带内部上拉电阻的8位双向I/O口,P1的输出缓冲级可驱动4个TTL电路。对端口写“1”,通过内部的电阻把端口拉到高电平,此时可作为输入口。因为内部有电阻,某个引脚被外部信号拉低时输出一个电流。闪烁编程时和程序校验时,P1口接收低8位地址。 P2口:P2口是一个内部带有上拉电阻的8位双向I/O口,P2的输出缓冲级可驱动4个TTL电路。对端口写“1”,通过内部的电阻把端口拉到高电平,此时,可作为输入口。因为内部有电阻,某个引脚被外部信号拉低时会输出一个电流。在访问外部程序存储器或16位地址的外部数据存储器时,P2口送出高8位地址数据。在访问8位地址的外部数据存储器时,P2口线上的内容在整个运行期间不变。闪烁编程或校验时,P2口接收高位地址和其它控制信号。 P3口:P3口是一组带有内部电阻的8位双向I/O口,P3口输出缓冲故可驱动4个TTL电路。对P3口写如“1”时,它们被内部电阻拉到高电平并可作为输入端时,被外部拉低的P3口将用电阻输出电流。 P3口除了作为一般的I/O口外,更重要的用途是它的第二功能,如下表所示 端口引脚 第二功能 P3.0 RXD P3.1 TXD P3.2 INT0 P3.3 INT1 P3.4 T0 P3.5 T1 P3.6 WR P3.7 RD -lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous6icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high 表2..1 P3口第二功能 P3口还接收一些用于闪烁存储器编程和程序校验的控制信号。 RST: 复位输入。当震荡器工作时,RET引脚出现两个机器周期以上的高电平将使单片机复位。 PROGALE/: 当访问外部程序存储器或数据存储器时,ALE输出脉冲用于锁存地址的低8位字节。即使不访问外部存储器,ALE以时钟震荡频率的1/16输出固定的正脉冲信号,因此它可对输出时钟或用于定时目的。要注意的是:每当访问外部数据存储器时将跳过一个ALE脉冲时,闪烁存储器编程时,这个引脚还用于输入编程脉冲。如果必要,可对特殊寄存器区中的8EH单元的D0位置禁止ALE操作。这个位置后只有一条MOVX和MOVC指令ALE才会被应用。此外,这个引脚会微弱拉高,单片机执行外部程序时,应设置ALE无效。 PSEN:程序储存允许输出是外部程序存储器的读选通信号,当AT89C51由外部程序存储器读取指令时,每个机器周期两次PSEN 有效,即输出两个脉冲。在此期间,当访问外部数据存储器时,这两次有效的PSEN 信号不出现。 EA/VPP:外部访问允许。欲使中央处理器仅访问外部程序存储器,EA端必须保持低电平。需要注意的是:如果加密位LBI被编程,复位时内部会锁存EA端状态。如EA端为高电平,CPU则执行内部程序存储器中的指令。闪烁存储器编程时,该引脚加上+12V的编程允许电压VPP,当然这必须是该器件是使用12V编程电压VPP。 XTAL1:震荡器反相放大器及内部时钟发生器的输入端。 XTAL2:震荡器反相放大器的输出端。 AT89C51中有一个用于构成内部震荡器的高增益反相放大器,时钟震荡器: 引脚XTAL1和XTAL2分别是该放大器的输入端和输出端。这个放大器与作为反馈元件的片外石英晶体或陶瓷谐振器一起构成自然震荡器。 外接石英晶体及电容C1,C2接在放大器的反馈回路中构成并联震荡电路。对外接电容C1,C2虽然没有十分严格的要求,但电容容量的大小会轻微影响震荡频率的高低、震荡器工作的稳定性、起振的难易程序及温度稳定性。如果使用石英晶体,我们推荐电容使用30PF?10PF,而如果使用陶瓷振荡器建议选择40PF?10PF。用户也可以采用外部 7 时钟。采用外部时钟的电路如图示。这种情况下,外部时钟脉冲接到XTAL1端,即内部时钟发生器的输入端,XTAL2则悬空。由于外部时钟信号是通过一个2分频触发器后作为内部时钟信号的,所以对外部时钟信号的占空比没有特殊要求,但最小高电平持续时间和最大的低电平持续时间应符合产品技术条件的要求。 图3.2内部振荡电路 图3.3闲散节电模式 AT89C51有两种可用软件编程的省电模式,它们是闲散模式和掉电工作模式。这两种方式是控制专用寄存器PCON中的PD和IDL位来实现的。PD是掉电模式,当PD=1时,激活掉电工作模式,单片机进入掉电工作状态。IDL是闲散等待方式,当IDL=1,激活闲散工作状态,单片机进入睡眠状态。如需要同时进入两种工作模式,即PD和IDL同时为1,则先激活掉电模式。在闲散工作模式状态,中央处理器CPU保持睡眠状态,而所有片内的外设仍保持激活状态,这种方式由软件产生。此时,片内随机存取数据存储器和所有特殊功能寄存器的内容保持不变。闲散模式可由任何允许的中断请求或硬件复位终止。终止闲散工作模式的方法有两种,一是任何一条被允许中断的事件被激活,IDL被硬件清除,即刻终止闲散工作模式。程序会首先影响中断,进入中断服务程序,执行完中断服务程序,并紧随RETI指令后,下一条要执行的指令就是使单片机进入闲散工作模式,那条指令后面的一条指令。二是通过硬件复位也可将闲散工作模式终止。需要注意的是:当由硬件复位来终止闲散工作模式时,中央处理器CPU通常是从激活空闲模式那条指令的下一条开始继续执行程序的,要完成内部复位操作,硬件复位脉冲要保持两个机器周期有效,在这种情况下,内部禁止中央处理器CPU访问片内RAM,而允许访问其他端口,为了避免可能对端口产生的意外写入:激活闲散模式的那条指令后面的一条指令不应是一条对端口或外部存储器的写入指令。 quality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous8icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization an 掉电模式: 在掉电模式下,振荡器停止工作,进入掉电模式的指令是最后一条被执行的指令,片内RAM和特殊功能寄存器的内容在中指掉电模式前被冻结。退出掉电模式的唯一方法是硬件复位,复位后将从新定义全部特殊功能寄存器但不改变RAM中的内容,在VCC恢复到正常工作电平前,复位应无效切必须保持一定时间以使振荡器从新启动并稳定工作。 程序存储 模式 ALE P0 P1 P2 P3 PSEN 器 闲散模式 内部 1 1 数据 数据 数据 数据 闲散模式 内部 1 1 浮空 数据 地址 数据 掉电模式 外部 0 0 数据 数据 数据 数据 掉电模式 外部 0 0 数据 数据 数据 数据 表2.2闲散和掉电模式外部引脚状态。 程序存储器的加密 AT89C51可使用对芯片上的三个加密位LB1,LB2,LB3进行编程(P)或不编程(U)得到如下表所示的功能: 程序加密位 保护类型 1 U U U 没有程序保护功能 禁止从外部程序存储器中执行MOVC指令读取内部程序存储器2 P U U 的内容 3 P P U 除上表功能外,还禁止程序校验 4 P P P 除以上功能外,同时禁止外部执行 表2.3程序存储器的加密 当LB1被编程时,在复位期间,EA端的电平被锁存,如果单片机上电后一直没有复位,锁存起来的初始值是一个不确定数,这个不确定数会一直保存到真正复位位置。为了使单片机正常工作,被锁存的EA电平与这个引脚当前辑电平 9 一致。机密位只能通过整片擦除的方法清除。 3.2MAX232电平芯片介绍 MAX232芯片是美信公司专门为电脑的RS-232标准串口设计的接口电路,使用+5v单电源供电。 内部结构基本可分三个部分: 第一部分是电荷泵电路。由1、2、3、4、5、6脚和4只电容构成。功能是产生+12v和-12v两个电源,提供给RS-232串口电平的需要。 第二部分是数据转换通道。由7、8、9、10、11、12、13、14脚构成两个数据通道。 其中13脚(R1IN)、12脚(R1OUT)、11脚(T1IN)、14脚(T1OUT)为第一数据通道。 8脚(R2IN)、9脚(R2OUT)、10脚(T2IN)、7脚(T2OUT)为第二数据通道。 TTL/CMOS数据从T1IN、T2IN输入转换成RS-232数据从T1OUT、T2OUT送到电脑DP9插头;DP9插头的RS-232数据从R1IN、R2IN输入转换成TTL/CMOS数据后从R1OUT、R2OUT输出。 第三部分是供电。15脚DNG、16脚VCC(+5v)。 电平转换电路如下: 图3.4 MAX232电平芯片 lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous10icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high- 3.3 硬件电路设计图 3.3.1 PC机与单片机通信接口电路设计框图 本文采用MAx232作为PC机与单片机的串行通信接口芯片。硬件连接时,可从MAX232中的2路发送器和接收器中任选一路,只要注意发送与接收的引脚对应关系即可。接口电路如图3.5所示。 图3.5 PC机与单片机通信接口电路设计框图 3.3.2整体设计原理图 总体设计按照整体设计思路方案绘制原理图如下所示: 11 图3.6整体设计原理图 4软件设计 4.1上位机程序设计 void CTem_conDlg::OnOnCommMscomm1() { // TODO: Add your control notification handler code here m_strRXData=" "; //每次进入则将编辑框内容清空等待显示新的数据 VARIANT variant_inp; LONG len,k; BYTE rxdata[2048]; //设置BYTE数组 CString strtemp; if(m_ctrlComm.GetCommEvent()==2)//事件值为2表示接收缓冲区内有字符 { //以下你可以根据自己的通信 协议 离婚协议模板下载合伙人协议 下载渠道分销协议免费下载敬业协议下载授课协议下载 加入//处理代码 variant_inp=m_ctrlComm.GetInput();//读缓冲区 safearray_inp=variant_inp; //VARIANT型变量转换为//ColeSafeArray型变量 len=safearray_inp.GetOneDimSize();//得到有效数据长度 for(k=0;k #define XTAL 11059200 // CUP 晶振频率 #define baudrate 9600 // 通信波特率 #define uchar unsigned char #define uint unsigned int sbit DQ = P3^3; // 定义DS18B20端口DQ sbit BEEP = P3^7; unsigned char presence ; unsigned char code LEDData1[ ] ={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0xff}; unsigned char code LEDData[ ] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8, 0x80,0x90,0xff}; unsigned char data temp_data[2] = {0x00,0x00}; unsigned char data display[5] = {0x00,0x00,0x00,0x00,0x00}; unsigned char code ditab[16] = {0x00,0x01,0x01,0x02,0x03,0x03,0x04,0x04, 0x05,0x06,0x06,0x07,0x08,0x08,0x09,0x09}; void beep(); sbit DIN = P0^7; // 小数点 bit flash=0; // 显示开关标记 bit flag_zf=0; // 正负温度标志 /**********************************************************/ void Delay(unsigned int num)// 延时函数 { while( --num ); } 13 /**********************************************************/ uchar Init_DS18B20(void) // 初始化ds1820 { DQ = 1; // DQ复位 Delay(8); // 稍做延时 DQ = 0; // 单片机将DQ拉低 Delay(90); // 精确延时 大于 480us DQ = 1; // 拉高总线 Delay(8); presence = DQ; // 如果=0则初始化成功 =1则初始化失败 Delay(100); DQ = 1; return(presence); // 返回信号,0=presence,1= no presence } /**********************************************************/ uchar ReadOneChar(void) // 读一个字节 { unsigned char i = 0; unsigned char dat = 0; for (i = 8; i > 0; i--) { DQ = 0; // 给脉冲信号 dat >>= 1; DQ = 1; // 给脉冲信号 if(DQ) dat |= 0x80; Delay(4); } return (dat); -lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous14icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high } /**********************************************************/ void WriteOneChar(unsigned char dat)// 写一个字节 { unsigned char i = 0; for (i = 8; i > 0; i--) { DQ = 0; DQ = dat&0x01; Delay(5); DQ = 1; dat>>=1; } } /*********************************************************/ void Read_Temperature(void)// 读取温度 { Init_DS18B20(); if(presence==1) { beep(); flash=1; } // DS18B20不正常,蜂鸣器报警 else { flash=0; WriteOneChar(0xCC); // 跳过读序号列号的操作 WriteOneChar(0x44); // 启动温度转换 Init_DS18B20(); WriteOneChar(0xCC); // 跳过读序号列号的操作 WriteOneChar(0xBE); // 读取温度寄存器 15 temp_data[0] = ReadOneChar(); // 温度低8位 temp_data[1] = ReadOneChar(); // 温度高8位 } } /*********************************************************/ void Disp_Temperature()// 显示温度 { unsigned char n=0; if(temp_data[1]>7) //当温度高八位中的高五位全为O { flag_zf=1; // 所测温度为负时,要进行转换 temp_data[1]=!( temp_data[1]); temp_data[0]=!( temp_data[0]); temp_data[0]= temp_data[0]+1; if(temp_data[0]=0) { temp_data[1]= temp_data[1]+1;} } Else {flag_zf=0} //判断测得的温度数据是正还是负,如果为 正,不做任何 //理 display[4]=temp_data[0]&0x0f; display[0]=ditab[display[4]]; // 查表得小数位的值 display[4]=((temp_data[0]&0xf0)>>4)|((temp_data[1]&0x0f)<<4); display[3]=display[4]/100; display[1]=display[4]%100; display[2]=display[1]/10; display[1]=display[1]%10; if(flag_zf=1) {p0=0xbf; P2=0x02; l deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous16icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of high Delay(300);} //温度为负数时第二个数码管显示负号 if(!display[3]) // 高位为0,不显示 { display[3]=0x0a; if(!display[2]) // 次高位为0,不显示 display[2]=0x0a; } P0 = 0xc6; // 显示 C P2 = 0xfe; // 位选线为P2.7口,LED为共阳极显示,当位选线为低电 平时选通 Delay(300); P0 = 0x9c; // 显示 ? P2 = 0xfd; // 选中P2.6口 Delay(300); P0 =LEDData[display[0]] ; // 显示小数位 P2 = 0xfb; //p2.5 Delay(300); P0 =LEDData1[display[1]]; // 显示个位 P2 = 0xf7; Delay(300); P0 =LEDData[display[2]]; // 显示十位 P2 = 0xef; Delay(300); P0 =LEDData[display[3]]; // 显示百位 P2 = 0xdf; Delay(300); 17 P2 = 0xff; // 关闭显示 } /*********************************************************/ void beep(void) { unsigned char i; for (i=0;i<100;i++) { Delay(60); BEEP=!BEEP; // BEEP取反 } BEEP=1; // 关闭蜂鸣器 } /*********************************************************/ void init(void) { EA = 1; // "中断总允许" TMOD = 0x20; // 定时器1工作于8位自动重载模式, 用于产生波特 率 TH1=(unsigned char)(256 - (XTAL / (32L * 12L * baudrate))); TL1=(unsigned char)(256 - (XTAL / (32L * 12L * baudrate))); // 定时器0 赋初值 SCON = 0x50; // 设定串行口工作方式 PCON &= 0x00; // 波特率不倍增 TR1 = 1; // 启动定时器1 IE = 0x00; // 禁止任何中断 } /*********************************************************/ void send_char(void) // 传送十六位的温度数据,低位在前 lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous18icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high- { unsigned i=0; while (i < 2) { SBUF = temp_data[i]; while (!TI); // 等特数据传送 TI = 0; // 清除数据传送标志 i++; } } /*********************************************************/ void main(void) { uchar receive; init(); while(1) { Read_Temperature(); // 读取温度 if (flash==0) { Disp_Temperature(); // 显示温度 } else { P2 = 0x00 ; // DS18B20不正常,关闭显示 } if (RI) // 是否有数据到来 { RI = 0; receive = SBUF; if (receive == 49) // 是否开始采集温度 19 { send_char(); // 传送采集的温度 } } } } owned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous20icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept o 5仿真与调试 5.1PROTEUS软件仿真 5.1.1 Protues简介 Protues软件是英国Labcenter electronics公司出版的EDA工具软件(该软件中国总代理为广州风标电子技术有限公司)。它不仅具有其它EDA工具软件的仿真功能,还能仿真单片机及外围器件。它是目前最好的仿真单片机及外围器件的工具。虽然目前国内推广刚起步,但已受到单片机爱好者、从事单片机教学的教师、致力于单片机开发应用的科技工作者的青睐。Proteus是世界上著名的EDA工具(仿真软件),从原理图布图、代码调试到单片机与外围电路协同仿真,一键切换到PCB设计,真正实现了从概念到产品的完整设计。是目前世界上唯一将电路仿真软件、PCB设计软件和虚拟模型仿真软件三合一的设计平台,其处理器模型支持8051、HC11、PIC10/12/16/18/24/30/DsPIC33、AVR、ARM、8086和MSP430等,2010年 即将增加Cortex和DSP系列处理器,并持续增加其他系列处理器模型。在编译方面,它也支持IAR、Keil和MPLAB等多种编译器。 protues支持当前的主流单片机,如51系列、AVR系列、PIC12系列、PIC16系列、PIC18系列、Z80系列、HC11系列、68000系列等。 1)提供软件调试功能 2)提供丰富的外围接口器件及其仿真 RAM,ROM,键盘,马达,LED,LCD,AD/DA,部分SPI器件,部分IIC器件。这样很接近实际。 3) 提供丰富的虚拟仪器 利用虚拟仪器在仿真过程中可以测量外围电路的特性,培养学生实际硬件的调试能力。 4) 具有强大的原理图绘制功能 在PROTUES绘制好原理图后,调入已编译好的目标代码文件:*.HEX,可以在PROTUES的原理图中看到模拟的实物运行状态和过程。 PROTUES 是单片机课堂教学的先进助手。 21 PROTUES不仅可将许多单片机实例功能形象化,也可将许多单片机实例运行过程形象化。前者可在相当程度上得到实物演示实验的效果,后者则是实物演示实验难以达到的效果。 它的元器件、连接线路等却和传统的单片机实验硬件高度对应。这在相当程度上替代了传统的单片机实验教学的功能,例:元器件选择、电路连接、电路检测、电路修改、软件调试、运行结果等。 课程设计、毕业设计是学生走向就业的重要实践环节。由于PROTUES提供了实验室无法相比的大量的元器件库,提供了修改电路设计的灵活性、提供了实验室在数量、质量上难以相比的虚拟仪器、仪表,因而也提供了培养学生实践精神、创造精神的平台 随着科技的发展,“计算机仿真技术”已成为许多设计部门重要的前期设计手段。它具有设计灵活,结果、过程的统一的特点。可使设计时间大为缩短、耗资大为减少,也可降低工程制造的风险。相信在单片机开发应用中PROTUES也能茯得愈来愈广泛的应用。 5.1.2 protues仿真电路图 or policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous22icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspecia 图5.1总体仿真电路原理图 用搭建好的原理图放在protues软件中进行仿真,当单片机采集到数据时通过一系列的转换最终送到上位机进行数据显示,从上位机即可得到下位机采集到的数据,从而完成上位机与下位机的通信。 5.2 VC软件仿真 步骤1:打开VC软件,新建文件,选择【MFC AppWizard exe】项,工程名取为【tem_con】,单击【OK】按钮,如图所示。 23 图5.2打开VC软件界面 步骤2选择【Dialog based】项,单击【Finish】按钮,如图所示 quality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous24icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization an 图5.3选择基本对话框 步骤3:单击【Project->Add to project->Components and Controls...】菜单项,如图所示。 图5.4添加工程 步骤4:等待软件打开文件夹,双击【Registered ActveX Controls】文件夹,如图所示。 25 图5.5软件打开文件夹 步骤5:选择【Microsoft Communications Control,version 6.0】列表项,单击【Insert】按钮,如图所示。 quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous26icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu- 图5.6 选择Microsoft Communications Control,version 6.0 步骤6:接着弹出【Confirm Classes】对话框,默认不修改,单击【OK】按 钮,如图所示。 27 图5.7弹出Confirm Classe对话框 步骤7:将控件工具条中的串行口控件拖动到对话框中,用鼠标左键点住 ,一直拖到对话框中,在任意位置释放左键,如图所示。 -lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous28icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high 图5.8添加串口控件 步骤8:单击【View->ClassWizard】菜单项打开【MFC ClassWizard】对话框,选中【IDC_MSCOMM1】和【OnComm】列表项,单击【Add Function...】按钮,如图所示。 29 图5.9 Add Function 步骤9:一直单击【OK】按钮,我们就会看到增加【OnOnCommMscomm1()】函数,如图所示。 图5.10增加OnOnCommMscomm函数 在对话框中添加编辑框控件,步骤10:选择控件工具条中的编辑框控件abl, 如图所示。 图5.11添加编辑框控件 步骤11:在【MFC ClassWizard】对话框中,单击【Member Variables】选项卡,为编辑框和串行口选择关联变量m_strRXData和m_ctrlComm,单击【OK】 d to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous30icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deve 按钮,如图所示。 图5.12选择关联变量m_strRXData和m_ctrlComm 步骤12:在【OnOnCommMscomm1()】函数中添加代码,添加完代码后的界面如图所示。 图5.13在OnOnCommMscomm1()函数中添加代码 步骤13:在【OnInitDialog()】函数中添加代码,添加完代码后的界面如图所示。 31 图514在OnInitDialog()函数中添加代码 5.4 VC软件界面仿真 如下图5.2所示为VC软件界面仿真图: 5.2 VC软件界面仿真图 此界面仿真结果表示当前的环境温度为28.7度。 owned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous32icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept o 结束语 本文主要详述了AT89C51单片机与PC机的串行通信的实现的设计和内容,AT89C51是一种带4K字节闪烁可编程可擦除只读寄存器(FPEROM—Flash Programmable and Erasable Read Only Memory)的低电压,高性能CMOS 8位微处理器。该器件采用ATMEL高密度非易失存储器制造技术制造,与工业标准的MCS-51指令集和输出管脚相兼容。由于将多功能8位CPU和闪烁存储器组合在单个芯片中,ATMEL的AT89C51是一种高效微控制器,所以它的使用前景会是相当广泛与受欢迎。因此我们有必要来学习它与PC机的通信。 主要论述内容 总结 初级经济法重点总结下载党员个人总结TXt高中句型全总结.doc高中句型全总结.doc理论力学知识点总结pdf 如下: 1. 介绍了单片机的在现实生活中的使用情况与应用环境领域,市场前景与未来应用,并对总体设计做了概括性的描述。 2. 详述了单片机的发展概况、特点、应用,各个部件的原理,串行口的通信方式,显示管的工作原理,使各个部件都能被读者所了解,从而方便人们来认识AT89C51与PC机串行通信的原理。 3. 介绍了软件设计,流程,通信协议,初始化,波特率计算等软件上的准备与设计,从而为整个设计的汇编阶段做好准备。最后采用运用汇编语言将整个图纸上的设计变为实际的应用。 33 当然本设计也存在着很大的问题,比如说功能上相对简单容易出错等,这些问题可以在以后的工作中继续完善。 经过几个月的毕业设计,因为时间和任务的性质的关系,没有完全按照上述的测试方法进行测试,但经过一些简单的步骤的测试,证明本设计的串行通信的稳定性与实用性。在设计的过程中我体会到了过程的快乐和结果的喜悦。人们常常说不要看重结果,主要是过程,这几个月的过程也让我深深的体会到了自己知识的匮乏和掌握的不牢固为此在将来势必要不断地继续学习与深造,为此不断地完善自我。 致 谢 经过几个月的努力,终于完成了PC机与单片机的串行通信这个毕业设计。在此,我要衷心感谢我的指导老师王伟老师,在整个毕业设计过程中,他给予了我悉心的指导和无私的帮助,同时还要感谢同班的许多同学,我们在相互学习和交流中,解决问题共同进步。有了这么多的支持和无私帮助,才使我得以顺利完成毕业设计。 衷心感谢在百忙之中评阅论文的各位老师~感谢电子工程系的所有老师,感谢您们为我们的学习与成才创造的各种条件和付出的辛勤劳动。感谢同室室友、师兄、师姐和朋友们在平时的学习、生活中给予了我很大的支持,在此表示衷心的感谢! 最后感谢我的家人,是他们给予我精神上的鼓励、生活上的照顾、学业上的支持,才使这篇论文得以顺利完成。 of cadres and workers of the existing business, firmly establish the concept oowned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous34icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to respon 参考文献 [1] 梅丽凤.单片机原理及接口技术,北京:清华大学出版社.2004-9 [2] 何立民.单片机应用系统设计,北京:航空航天大学出版社.1990-8 [3] 张毅刚.单片机原理及应用,北京:高等教育出版社.2003-3 [4] 王忠飞.MCS-51单片机原理及嵌入式系统应用.西安:西安电子科技大学出版社.2007-7 [5] 晁阳.单片机MCS-51原理及应用开发 教程 人力资源管理pdf成真迷上我教程下载西门子数控教程protel99se入门教程fi6130z安装使用教程 ,北京:清华大学出版社.2007-8 [6] 邓亚平.微型计算机接口技术.北京:清华大学出版社.2007-6 [7] 钟睿.MCS-51单片机原理及应用开发技术.北京:铁道部出版社.2006-4 [8] 张洪润.单片机应用设计200例.北京:北京航空大学出版社.2006-9 [9] 周杰英.微型计算机原理及应用.北京:机械工业出版社.2006-7 [10] 张雪兰.汇编语言程序设计.北京:清华大学出版社.2007-3 35 owned assets.(five) to strengthen the construction management personnel. Strengthen the management of education and training -ging the development, ensure that the value of stateleveracedures, strict regulation of economic activities, attract injection the social investment to the industry group, to achieve k of national policies and regulations, strict inspection and argumentation, legal consultation, examination and approval prowin principle, in the framewor-e city resources, other industries and regional resources, mutual trust, mutual benefit, seeking winmote the integration of resources. To further broaden their horizons, effective integration of resources within the group, thto prosiness road the competition of alienation and characteristics, the pursuit of stability and development of the market.(four) influence and coverage of the brand, the implementation of key breakthroughs, to enhance the competitive strength, walking buarket , enhance the competitive strength. Concentrated manpower, careful planning, packaging and publicity of a number of unique, mly promote the brand. To establish brand awareness, awareness of the use of brand, brand value, brand acquisition performancetheir own conditions to develop the correct road, the maximum to avoid investment risk, gain profit.(three) vigorous36icy, projects and funds, enterprise and industry group mission to promote leapfrog development.lly the policy of industrial development, financial investment policy, financial policy and tax policy, and actively seek polspeciaor policy. Serious research about social support the development of cultural undertakings in the country and the XX policy, ed upgrading ability, enhance core competitiveness, adapt to the need of market competition.(six) seriously study the policy fre optimization anquality professional management team, hard work, and promote the entire workforce knowledge structure, age structure, structu-quality management management personnel, and strive to build a high-lopment, vigorously the introduction of highl deved to market competition, improve management and operation of the market. At the same time, according to the need of industriaf the market, enhance the sense of crisis to adapt to market competition, the sense of urgency, improve the ability to responof cadres and workers of the existing business, firmly establish the concept o
本文档为【毕业设计&#40;论文&#41;-VC编程软件来开发上位机与下位机之间通信编程 &#40;2&#41;&#40;1&#41;】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_321635
暂无简介~
格式:doc
大小:540KB
软件:Word
页数:66
分类:工学
上传时间:2017-12-08
浏览量:18