Keil c51的使用及界面翻译

Keil c51的使用及界面翻译
Keil c51的使用及界面翻译

Keil C51的使用方法

Keil C51 软件是众多单片机应用开发的优秀软件之一,它集编辑,编译,仿真于一体,支持汇编,PLM 语言和C 语言的程序设计,界面友好,易学易用。

下面介绍Keil C51软件的使用方法

进入Keil C51 后,屏幕如下图所示。几秒钟后出现编辑界

进入Keil C51后的编辑界面

简单程序的调试

学习程序设计语言、学习某种程序软件,最好的方法是直接操作实践。下面通过简单的编程、调试,引导大家学习Keil C51软件的基本使用方法和基本的调试技巧。

1)建立一个新工程

单击Project菜单,在弹出的下拉菜单中选中New Project选项

2)然后选择你要保存的路径,输入工程文件的名字,比如保存到C51目录里,工程文件的名字为C51

如下图所示,然后点击保存.

3)这时会弹出一个对话框,要求你选择单片机的型号,你可以根据你使用的单片机来选择,keil c51几乎支持所有的51核的单片机,我这里还是以大家用的比较多的Atmel 的89C51来说明,如下图所示,选择89C51之后,右边栏是对这个单片机的基本的说明,然后点击确定.

4)完成上一步骤后,屏幕如下图所示

到现在为止,我们还没有编写一句程序,下面开始编写我们的第一个程序。

5)在下图中,单击“File”菜单,再在下拉菜单中单击“New”选项

新建文件后屏幕如下图所示

此时光标在编辑窗口里闪烁,这时可以键入用户的应用程序了,但笔者建议首先保存该空白的文件,单击菜单上的“File”,在下拉菜单中选中“Save As”选项单击,屏幕如下图所示,在“文件名”栏右侧的编辑框中,键入欲使用的文件名,同时,必须键入正确的扩展名。注意,如果用C语言编写程序,则扩展名为(.c);如果用汇编语言编写

程序,则扩展名必须为(.asm)。然后,单击“保存”按钮。

6)回到编辑界面后,单击“Target 1”前面的“+”号,然后在“Source Group 1”上单击右键,弹出如下菜单

然后单击“Add File to Group …Source Group 1?” 屏幕如下图所示

选中Test.c,然后单击“Add ”屏幕好下图所示

注意到“Source Group 1”文件夹中多了一个子项“Text1.c”了吗?子项的多少与所增加的源程序的多少相同

在输入上述程序时,读者已经看到了事先保存待编辑的文件的好处了吧,即Keil c51会自动识别关键字,并以不同的颜色提示用户加以注意,这样会使用户少犯错误,有利于提高编程效率。程序输入完毕

后,如下图所示

8)在上图中,单击“Project”菜单,再在下拉菜单中单击“Built Target”选项(或者使用快捷键F7),编译成功后,再单击“Project”菜单,在下拉菜单中单击“Start/Stop Debug Session”(或者使用快捷键

Ctrl+F5),屏幕如下所示

9)调试程序:在上图中,单击“Debug”菜单,在下拉菜单中单击“Go”选项,(或者使用快捷键F5),然后再单击“Debug”菜单,在下拉菜单中单击“Stop Running”选项(或者使用快捷键Esc);再单击“View”菜单,再在下拉菜单中单击“Serial Windows #1”选项,就可以看到程

序运行后的结果,其结果如下图所示

至此,我们在Keil C51上做了一个完整工程的全过程。但这只是纯软件的开发过程,如何使用程序下载器看一看程序运行的结果呢?

10)单击“Project”菜单,再在下拉菜单中单击

“ ” 在下图中,单击“Output”中单击“Create HEX File” 选项,使程序编译后产生HEX代码,供下载器软件使用。把程序下载到AT89S51单片机中。

Keil C51的界面翻译

Keil uVision2是目前使用广泛的单片机开发软件,它集成了源程序编辑和程序调试于一体,支持汇编、C、PL/M语言。

这里我们仅仅介绍 Keil uVision2 的简单使用,更详细的使用方法见本光盘\单片机软件\Keil c51\Keil书籍与资料目录中的内容。

一、文件(File)菜单

文件菜单下都是常见的项,不再给出对应的工具按钮。

1)New 2)Open

3)Close 4)Save

5)Save as…

6)Device Database:维护器件数据库

7)Print Setup…:设置打印机

8)Print 9)Exit

二、编辑(Edit)菜单

1)Undo 2)Redo:恢复上次的撤销

3)Cut 4)Copy

5)Paste

6)Indent Select Text:缩进一个制表符位

7)Unindent Select Text左移一个制表符位

8)Toggle Bookmark:在当前行置书签

9)Goto Next Bookmark移光标到下一书签

10)Goto Previous Bookmark:移光标到上一个书签

11)Clear All Bookmark:清除当前文件中所有的书签

12)Find…

13)Replace…:查找与替换

14)Find in Files…:在多个文件中查找字符串

15)Goto Matching Brace:寻找匹配的各种括号

三、查看(View)菜单

1)Status Bar:显示或隐藏状态栏

2)File Toolbar:显示或隐藏文件工具栏

3)Build Toolbar:显示或隐藏编译工具栏

4)Debug Toolbar:显示或隐藏调试工具栏

5)Project Windows:显示或隐藏工程窗口

6)Output Windows:显示或隐藏输出窗口

7)Source Browser:打开源文件浏览器窗口

8)Disassembly Windows:显示或隐藏反汇编窗口

9)Watch & Call Stack Windows:显示或隐藏观察和堆栈窗口10)Memory Windows:显示或隐藏存储器窗口

11)Code Coverage Windows:显示或隐藏代码覆盖窗口12)Performance Analyzer Windows:显示或隐藏性能分析窗口13)Symbol Windows:显示或隐藏符号变量窗口

14)Serial Windows #1:显示或隐藏串行口窗口1

15)Serial Windows #2:显示或隐藏串行口窗口2

16)Toolbox:显示或隐藏工具箱

17)Periodic Windows Update:在调试运行程序时,周期刷新调试窗口18)Workbook Mode:显示或隐藏工作簿窗口的标签

19)Option…:设置颜色、字体、快捷键和编辑器选项

四、工程(Project)菜单

1)New Project…:创建一个新工程

2)Import μVision2 Project…:导入工程文件

3)Open Project:打开一个已有工程

4)Close Project:关闭当前工程

5)Components Environment and Books设置工具书、包含文件和库文件路径6)Select Device for Target:从器件库中选择一种CPU

7)Remove Groups…:从工程中删去组或文件

8)Option for Target…:设置对象、组或文件的工具选项,设置当前目标选项,选择当前目标

9)Build Target:编译修改过的文件并生成应用

10)Rebuild Target:重新编译所有的文件并生成应用

11)Translate…:编译当前文件

12)Stop Build:停止当前的编译过程

五、调试(Debug)菜单

1)Start/Stop Debugging:启动/停止调试模式

2)Go:全速运行

3)Step:跟踪运行

4)Step Over:单步运行

5)Step out of current function:一步执行完当前函数并返回

6)Run to Cursor line:一步运行到当前光标处

7)Stop Running:停止运行

8)Breakpointing…:打开断点对话框

9)Insert/Remove Breakpoint:在当前行设置/清除断点

10)Enable/Disable Breakpoint:使能/禁止当前行的断点

11)Disable All Breakpoints:禁止所有断点

12)Kill All Breakpoints:清除所有断点

13)Show Next Statement:显示下一条指令

14)Enable/Disable Trace Recording:使能/禁止跟踪记录

15)View Trace Records:显示执行过的指令

16)Memory Map…:打开存储空间配置对话框

17)Performance Analyzer…:打开性能分析设置窗口

18)Inline Assembly…:对某一行重新汇编,且可以修改汇编代码

19)Function Editor…:编辑调试函数和调试配置文件

六、片内外设(Peripheral)菜单

1)Reset CPU:复位CPU

2)Interrupt:设置/观察中断(触发方式、优先级、使能等)

3)I/O Ports:设置/观察各个I/O口

4)Serial:设置/观察串行口

5)Timer:设置/观察各个定时器/计数器

6)A/D Converter:设置/观察A/D转换器

7)D/A Converter:设置/观察D/A转换器这一部分的内容,与选择CPU有关。

七、工具(Tools)菜单

1)Setup PC-Lint…:配置PC-Lint

2)Lint:用PC-Lint处理当前编辑的文件

3)Lint all C Source Files:用PC-Lint处理当前项目中所有的C文件4)Setup Easy-Case…:配置Siemens 的Easy-Case

5)Star/Stop Easy-Case:启动或停止Easy-Case

6)Show File(Line):用Easy-Case处理当前编辑的文件

7)Customize Tools Menu…:将用户程序加入工具菜单。

八、软件版本控制系统(SVCS)菜单软件版本控制系统菜单只有一项:Configure Version Control…:配置软件版本控制系统命令九、视窗(Windows)菜单

1)Cascade:以相互重叠方式排列文件窗口

2)Tile Horizontally:以不重叠方式水平排列文件窗口

3)Tile Vertically:以不重叠方式垂直排列文件窗口

4)Arrange Icons:在窗口的下方排列图标

5)Split:将当前窗口分成几个窗格

6)Close All:关闭所有窗口

十、帮助(Help)菜单

1)μVision Help:打开μVision在线帮助

2)Open Books Window:打开电子图书窗口

3)Simulated Peripheral s for…:显示片内外设信息

4)Internet Support Knowledegebase:打开互联网支持的知识库

5)Contact Support:联系方式支持

6)Check for Update:检查更新

7)About μVision:显示μVision的版本号和许可证信息

AT89C51单片机外文翻译

AT89C51外文翻译 Description The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash Programmable and Erasable Read Only Memory (PEROM). The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry standard MCS-51? instruction-set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. Features ? Compatible with MCS-51? Products ? 4K Bytes of In-System Reprogrammable Flash Memory – Endurance: 1,000 Write/Erase Cycles ? Fully Static Operation: 0 Hz to 24 MHz ? Three-Level Program Memory Lock ? 128 x 8-Bit Internal RAM ? 32 Programmable I/O Lines ? Two 16-Bit Timer/Counters ? Six Interrupt Sources ? Programmable Serial Channel ? Low Power Idle and Power Down Modes The AT89C51 provides the following standard features: 4K bytes of Flash,128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.

keil c51 详细中文手册

Keil C51使用详解 V1.0 第一章 Keil C51开发系统基本知识 (6) 第一节系统概述 (6) 第二节Keil C51单片机软件开发系统的整体结构 (6)

1. C51 for Dos 7 2. C51 for Windows的安装及注意事项: (7) 第四节Keil C51工具包各部分功能及使用简介 (7) 1. C51与A51. 7 2. L51和BL51. 8 3. DScope51,Tscope51及Monitor51. 8 4. Ishell及uVision. 9 第二章 Keil C51软件使用详解 (10) 第一节Keil C51编译器的控制指令 (10) 1. 源文件控制类 (10) 2. 目标文件(Object)控制类: (10) 3. 列表文件(listing)控制类: (10) 第二节dScope51的使用 (11) 1. dScope51 for Dos 11 2. dScope for Windows 12 第三节Monitor51及其使用 (13) 1. Monitor51对硬件的要求 (13) 2. Mon51的使用 (13) 3. MON51的配置 (13) 4. 串口连接图: (13) 5. MON51命令及使用 (14) 第四节集成开发环境(IDE)的使用 (14) 1. Ishell for Dos的使用 (14) 2. uVision for windows的使用 (15) 第三章 Keil C51 vs 标准C.. 15

第二节内存区域(Memory Areas): (16) 1. Pragram Area: (16) 2. Internal Data Memory: 16 3. External Data Memory. 16 4. Speciac Function Register Memory. 16 第三节存储模式 (16) 1. Small模式 (16) 2. Compact模式 (17) 3. large模式 (17) 第四节存储类型声明 (17) 第五节变量或数据类型 (17) 第六节位变量与声明 (17) 1. bit型变量 (17) 2. 可位寻址区说明20H-2FH.. 18 第七节Keil C51指针 (18) 1. 一般指针 (18) 2. 存储器指针 (18) 3. 指针转换 (18) 第八节Keil C51函数 (19) 1. 中断函数声明: (19) 2. 通用存储工作区 (19) 3. 选通用存储工作区由using x声明,见上例。 (19) 4. 指定存储模式 (19) 5. #pragma disable. 19 6. 递归或可重入函数指定 (19)

步进电机及单片机英文文献及翻译

外文文献: Knowledge of the stepper motor What is a stepper motor: Stepper motor is a kind of electrical pulses into angular displacement of the implementing agency. Popular little lesson: When the driver receives a step pulse signal, it will drive a stepper motor to set the direction of rotation at a fixed angle (and the step angle). You can control the number of pulses to control the angular displacement, so as to achieve accurate positioning purposes; the same time you can control the pulse frequency to control the motor rotation speed and acceleration, to achieve speed control purposes. What kinds of stepper motor sub-: In three stepper motors: permanent magnet (PM), reactive (VR) and hybrid (HB) permanent magnet stepper usually two-phase, torque, and smaller, step angle of 7.5 degrees or the general 15 degrees; reaction step is generally three-phase, can achieve high torque output, step angle of 1.5 degrees is generally, but the noise and vibration are large. 80 countries in Europe and America have been eliminated; hybrid stepper is a mix of permanent magnet and reactive advantages. It consists of two phases and the five-phase: two-phase step angle of 1.8 degrees while the general five-phase step angle of 0.72 degrees generally. The most widely used Stepper Motor. What is to keep the torque (HOLDING TORQUE) How much precision stepper motor? Whether the cumulative: The general accuracy of the stepper motor step angle of 3-5%, and not cumulative.

单片机Keil C51软件的使用方法

Keil C51软件的使用 Keil C51 软件是众多单片机应用开发的优秀软件之一,它集编辑、编译、仿真于一体,支持汇编和C 语言的程序设计,界面友好、易学易用。下面介绍Keil C51软件的使用方法: 1.启动Keil C51,界面如下图。 启动Keil C51时的屏幕 进入Keil C51后的编辑界面 2.建立一个新工程。

(1)单击工程菜单,在弹出的下拉菜单中选中新建工程选项。 (2)然后选择你要保存的路径,输入工程文件的名字,比如保存到C51目录里,工程文件的名字为C51,如下图所示,然后点击保存。 (3)这时会弹出一个对话框,要求你选择单片机的型号,你可以根据你使用的单片机来选择,Keil C51几乎支持所有的51核的单片机,我这里还是以大家用的比较多的Atmel 的89C51来说明,如下图所示,选择89C51之后,右边栏是对这个单片机的基本的说明,然后点击确定。

(4)完成上一步骤后,屏幕如下图所示。 (5)单击文件菜单,再在下拉菜单中单击新建选项,屏幕如下图所示。

此时光标在编辑窗口里闪烁,这时可以键入用户的应用程序了,建议首先保存该空白的文件,单击文件菜单,在下拉菜单中选中另存为选项单击,屏幕如下图所示,在文件名栏右侧的编辑框中,键入欲使用的文件名,同时,必须键入正确的扩展名。 注意,如果用C语言编写程序,则扩展名为.c;如果用汇编语言编写程序,则扩展名必须为.asm。然后,单击保存按钮。

回到编辑界面后,单击目标1前面的+号,然后在源程序组1上单击右键,弹出如下菜单, 然后单击增加文件到组‘源程序组1’,屏幕如下图所示, 选中c51.asm,然后单击Add,屏幕如下图所示,

单片机外文翻译

杭州电子科技大学信息工程学院毕业设计(论文)外文文献翻译 毕业设计(论文)题目用单片机实现的数字时钟电路设计文献综述题目单片机控制系统系电子工程 专业电子信息科学与技术 姓名郭筱楠 班级08091911 学号08919115 指导教师王维平

单片机控制系统 广义地说,微型计算机控制系统(单片机控制系统)是用于处理信息的,这种被用于处理的信息可以是电话交谈,也可以是仪器的读数或者是一个企业的帐户,但是各种情况下都涉及到相同的主要操作:信息的处理、信息的存储和信息的传递。在常规的电子设计中,这些操作都是以功能平台方式组合起来的,例如计数器,无论是电子计数器还是机械计数器,都要存储当前的数值,并且按要求将该数值增加1。一个系统例如采用计数器的电子钟之类的任一系统要使其存储和处理能力遍布整个系统,因为每个计数器都能存储和处理一些数字。 现如今,以微处理器为基础的系统从常规的处理方法中分离了出来,它将信息的处理,信息的存储和信息的传输三个功能分离形成不同的系统单元。这种主要将系统分成三个主要单元的分离方法是冯-诺依曼在20世纪40年代所设想出来的,并且是针对微计算机的设想。从此以后基本上所有制成的计算机都是用这种结构设计的,尽管他们包含着宽广的物理形式与物理结构,但从根本上来说他们均是具有相同基本设计的计算机。 在以微处理器为基础的系统中,处理是由以微处理器为基础的系统自身完成的。存储是利用存储器电路,而从系统中输入和输出的信息传输则是利用特定的输入/输出(I/O)电路。要在一个以微处理器为基础的时钟中找出执行具有计数功能的一个特殊的硬件组成部分是不可能的,因为时间存储在存储器中,而在固定的时间间隔下由微处理器控制增值。但是,规定系统运转过程的软件却规定了包含实现计数器计数功能的单元部分。由于系统几乎完全由软件所定义,所以对微处理器结构和其辅助电路这种看起来非常抽象的处理方法使其在应用时非常灵活。这种设计过程主要是软件工程,而且在生产软件时,就会遇到产生于常规工程中相似的构造和维护问题。 图1.1 微型计算机的三个组成部分 图1.1显示出了微型计算机中这三个单元在一个微处理器控制系统中是如何按照机器中的信息通信方式而联接起来的。该系统由微处理器控制,微处理器能够对其自身的存储器和输入/输出单元的信息传输进行管理。外部的连接部分与

51单片机外文文献

The Introduction of AT89C51 Description The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. Function characteristic The AT89C51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, one 5 vector two-level interrupt architecture, a full duplex serial port, one-chip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. Pin Description VCC:Supply voltage. GND:Ground.

单片机外文文献翻译

外文文献一单片机简介 单片机是一种集成在电路芯片,是采用超大规模集成电路技术把具有数据处理能力的中央处理器CPU随机存储器RAM、只读存储器ROM、多种I/O口和中断系统、定时器/计时器等功能(可能还包括显示驱动电路、脉宽调制电路、模拟多路转换器、A/D转换器等电路)集成到一块硅片上构成的一个小而完善的计算机系统。单片机也被称为微控制器(Microcontroller),是因为它最早被用在工业控制领域。单片机由芯片内仅有CPU的专用处理器发展而来。最早的设计理念是通过将大量外围设备和CPU集成在一个芯片中,使计算机系统更小,更容易集成进复杂的而对体积要求严格的控制设备当中。INTEL的Z80是最早按照这种思想设计出的处理器,从此以后,单片机和专用处理器的发展便分道扬镳。 二、单片机的发展趋势 现在可以说单片机是百花齐放,百家争鸣的时期,世界上各大芯片制造公司都推出了自己的单片机,从8位、16位到32位,数不胜数,应有尽有,有与主流C51系列兼容的,也有不兼容的,但它们各具特色,互成互补,为单片机的应用提供广阔的天地。 纵观单片机的发展过程,可以预示单片机的发展趋势,大致有: 1.低功耗CMOS MCS-51系列的8031推出时的功耗达630mW,而现在的单片机普遍都在100mW左右,随着对单片机功耗要求越来越低,现在的各个单片机制造商基本都采用了CMOS(互补金属氧化物半导体工艺)。象80C51就采用了HMOS(即高密度金属氧化物半导体工艺)和CHMOS(互补高密度金属氧化物半导体工艺)。CMOS虽然功耗较低,但由于其物理特征决定其工作速度不够高,而CHMOS则具备了高速和低功耗的特点,这些特征,更适合于在要求低功耗象电池供电的应用场合。所以这种工艺将是今后一段时期单片机发展的主要途径。 2.微型单片化 现在常规的单片机普遍都是将中央处理器(CPU)、随机存取数据存储(RAM)、只读程序存储器(ROM)、并行和串行通信接口,中断系统、定时电路、时钟电路集成在一块单一的芯片上,增强型的单片机集成了如A/D转换器、PMW(脉宽调制电路)、WDT(看门狗)、有些单片机将LCD(液晶)驱动电路都集成在单一的芯片上,这样 单片机包含的单元电路就更多,功能就越强大。甚至单片机厂商还可以根据用户的要求量身定做,制造出具有. 自己特色的单片机芯片。此外,现在的产品普遍要求体积小、重量轻,这就要求单片机除了功能强和功耗低外,还要求其体积要小。现在的许多单片机都具有多种封装形式,其中SMD(表面封装)越来越受欢迎,使得由单片机构成的系统正朝微型化方向发展。 3.主流与多品种共存 现在虽然单片机的品种繁多,各具特色,但仍以80C51为核心的单片机占主流,兼容其结构和指令系统的有PHILIPS公司的产品,ATMEL公司的产品和中国台湾

单片机外文翻译--STC89C52处理芯片

外文资料翻译 STC89C52 processi ng chip Prime features: With MCS - 51 SCM product compatibility, 8K bytes in the system programmable Flash memory, 1000 times CaXie cycle, the static operation: 0Hz ~ 33Hz, triple encryption program memory, 32 programmed I/O port, three 16 timer/counter, the eight uninterrupted dual-career UART serial passage, low power consumption, leisure and fall after fall electric power mode can be awakened and continuous watchdog timer and double-number poin ter, power ide ntifier. Efficacy: characteristics STC89C52 is one kind of low power consumption, high CMOS8 bit micro-co ntroller, 8K in system programmable Flash memory. Use high-de nsity nonv olatile storage tech no logy, and in dustrial 80C51 product in structi on and pin fully compatible. The Flash memory chips allows programs in the system, also suitable for programmable conventional programming. In a single chip, have clever 8 bits CPU and on li ne system programmable Flash, in crease STC89C52 for many embedded control system to provide high vigorous application and useful solutions. STC89C52 has following standard efficacy: 8k byte Flash RAM, 256 bytes, 32 I/O port, the watchdog timer, two, three pointer numerical 16 timer/counter, a 6 vector level 2 continuous structure, the serial port, working within crystals and horological circuit. In addition, 0Hz AT89S52 can drop to the static logic operation, support two software can choose power saving mode. Idle mode, the CPU to stop working, and allows the RAM, timer/c oun ters, serial, continu ous to work. Protectio n asa na patter n, RAM content is survival, vibrators frozen, SCM, until all the work under a continuous or hardware reset. 8-bit microcontrollers 8K bytes in the system programmable Flash AT89S52 devices. Mouth: P0 P0 mouth is a two-way ope n drain I/O. As export, each can drive eight TTL logic level. For P0 port to write "1", foot as the high impeda nee in put. When access to exter nal programs and nu merical memory, also known as

Keilc51程序中几种精确延时的方法

Keilc51程序中几种精确延时的方法 单片机因具有体积小、功能强、成本低以及便于实现分布式控制而有非常广泛的应用领域[1]。单片机开发者在编制各种应用程序时经常会遇到实现精确延时的问题,比如按键去抖、数据传输等操作都要在程序中插入一段或几段延时,时间从几十微秒到几秒。有时还要求有很高的精度,如使用单总线芯片DS18B20时,允许误差范围在十几微秒以内[2],否则,芯片无法工作。用51汇编语言写程序时,这种问题很容易得到解决,而目前开发嵌入式系统软件的主流工具为C语言,用C51写延时程序时需要一些技巧[3]。因此,在多年单片机开发经验的基础上,介绍几种实用的编制精确延时程序和计算程序执行时间的方法。 实现延时通常有两种方法:一种是硬件延时,要用到定时器/计数器,这种方法可以提高CPU的工作效率,也能做到精确延时;另一种是软件延时,这种方法主要采用循环体进行。 1 使用定时器/计数器实现精确延时 单片机系统一般常选用11.059 2 MHz、12 MHz或6 MHz晶振。第一种更容易产生各种标准的波特率,后两种的一个机器周期分别为1 μs和2 μs,便于精确延时。本程序中假设使用频率为12 MHz的晶振。最长的延时时间可达216=65 536 μs。若定时器工作在方式2,则可实现极短时间的精确延时;如使用其他定时方式,则要考虑重装定时初值的时间(重装定时器初值占用2个机器周期)。 在实际应用中,定时常采用中断方式,如进行适当的循环可实现几秒甚至更长时间的延时。使用定时器/计数器延时从程序的执行效率和稳定性两方面考虑都是最佳的方案。但应该注意,C51编写的中断服务程序编译后会自动加上PUSH ACC、PUSH PSW、POP PSW和POP ACC语句,执行时占用了4个机器周期;如程序中还有计数值加1语句,则又会占用1个机器周期。这些语句所消耗的时间在计算定时初值时要考虑进去,从初值中减去以达到最小误差的目的。 2 软件延时与时间计算 在很多情况下,定时器/计数器经常被用作其他用途,这时候就只能用软件方法延时。下面介绍几种软件延时的方法。 2.1 短暂延时 可以在C文件中通过使用带_NOP_( )语句的函数实现,定义一系列不同的延时函数,如Delay10us( )、Delay25us( )、Delay40us( )等存放在一个自定义的C文件中,需要时在主程序中直接调用。如延时10 μs的延时函数可编写如下: void Delay10us( ) { _NOP_( ); _NOP_( );

单片机的外文文献及中文翻译

SCM is an integrated circuit chip, is the use of large scale integrated circuit technology to a data processing capability of CPU CPU random access memory RAM, read-only memory ROM, a variety of I / O port and interrupt system, timers / timer functions (which may also include display driver circuitry, pulse width modulation circuit, analog multiplexer, A / D converter circuit) integrated into a silicon constitute a small and complete computer systems. SCM is also known as micro-controller (Microcontroller), because it is the first to be used in industrial control. Only a single chip by the CPU chip developed from a dedicated processor. The first design is by a large number of peripherals and CPU on a chip in the computer system, smaller, more easily integrated into a complex and demanding on the volume control device which. The Z80 INTEL is the first designed in accordance with this idea processor, then on the development of microcontroller and dedicated processors will be parting ways. Are 8-bit microcontroller early or 4 bits. One of the most successful is the INTEL 8031, for a simple, reliable and good performance was a lot of praise. Then developed in 8031 out of MCS51 MCU Systems. SCM systems based on this system until now is still widely used. With the increased requirements of industrial control field, began a 16-bit microcontroller, but not ideal because the cost has not been very widely used. After 90 years with the great development of consumer electronics, microcontroller technology has been a huge increase. With INTEL i960 series, especially the later series of widely used ARM, 32-bit microcontroller quickly replace high-end 16-bit MCU status and enter the mainstream market. The traditional 8-bit microcontroller performance have been the rapid increase capacity increase compared to 80 the number of times. Currently, high-end 32-bit microcontroller clocked over 300MHz, the performance catching the mid-90s dedicated processor, while the average model prices fall to one U.S. dollar, the most high-end [1] model only 10 dollars. Modern SCM systems are no longer only in the development and use of bare metal environment, a large number of proprietary embedded operating system is widely used in the full range of SCM. The handheld computers and cell phones as the core processing of high-end microcontroller can even use a dedicated Windows and Linux operating systems. SCM is more suitable than the specific processor used in embedded systems, so it was up to the application. In fact the number of SCM is the world's largest computer. Modern human life used in almost every piece of electronic and mechanical products will be integrated single chip. Phone, telephone, calculator, home appliances, electronic toys, handheld computers and computer accessories such as a mouse with a 1-2 in both the Department of SCM. Personal computer will have a large number of SCM in the work. General car with more than 40 microcontroller, a complex industrial control systems may even hundreds of single chip at the same time work! SCM is not only far exceeds the number of PC and other computing the sum, or even more than the number of human beings. Single chip, also known as single-chip microcontroller, it is not complete a certain logic chips, but to a computer system integrated into a chip. Equivalent to a

如何使用KeilC51创建一个工程文件

如何使用KeilC51创建一个工程文件 建立一个项目: 点击工程菜单中选择弹出的下拉式菜单中的新建工程...,接着弹出一个标准Windows 文件对话窗口,在"文件名"中输入您的第一个程序项目名称,这里我们用"test",这是笔者惯用的名称,大家不必照搬就是了,只要符合Windows文件规则的文件名都行。"保存"后的文件扩展名为uv2,这是KEIL uVision2项目文件扩展名,以后我们可以直接点击此文件以打开先前做的项目 。 这时会弹出让你选择单片机型号的对话框,我们选择A TMEL---A T89C51

然后点击Target 1前面的“+”,出现Source Group 1,选中右键点选“增加文件到组Source Group 1” 这时选择文件类型为Asm 源文件,再选中001.asm文件,再按添加,在随后出现的提示框中按“确定” 仿真器采用Mon51协议,在使用之前应必须对软件项目进行如下设置: 1、单击工程菜单,再在下拉菜单中单击"目标target 1属性" 在下图中,单击"Target"输入仿真器的工作频率(11.0592MHz)

2、在调试菜单中点选"Keil Monitor-51 Driver",即选择了STC89C516RD硬件仿真器。 3、单击“R外围设备”选Target Setup设置选项选择您要使用串口(必须和实际相符合),波特率38400。 如果被仿真的目标板使用12MHZ或者是11.0592MHZ晶振时波特率选择38400,如果被仿真的目标板使用6MHZ晶振时波特率选择18400。

4、如果需要生成HEX代码给编程器烧写芯片的话,需要选中“生成HEX 文件”的选项,按钮“选择OBJ文件夹...”是用来选择最终HEX文件的存放目录的。 5、按F7快捷键可以进行编译,编译成功后如会出现上图红箭头所指的文字,表示编译成

外文翻译---51系列单片机的结构和功能

外文翻译---51系列单片机的结构和功能

外文资料翻译 英文原文: Structure and function of the MCS-51 series Structure and function of the MCS-51 series one-chip computer MCS-51 is a name of a piece of one-chip computer series which Intel Company produces. This company introduced 8 top-grade one-chip computers of MCS-51 series in 1980 after introducing 8 one-chip computers of MCS-48 series in 1976. It belong to a lot of kinds this line of one-chip computer the chips have such as 8051, 8031, 8751, 80C51BH, 80C31BH,etc., their basic composition, basic performance and instruction system are all the same. 8051 daily representatives- 51 serial one-chip computers . An one-chip computer system is made up of several following parts: (1) One microprocessor of 8 (CPU). (2) At slice data memory RAM (128B/256B),it use not depositing not can reading /data that write, such as result not middle of operation, final result and data wanted to show, etc. (3) Procedure memory ROM/EPROM (4KB/8KB ), is used to preserve the procedure , some initial data and form in slice. But does not take ROM/EPROM within some one-chip computers, such as 8031 , 8032, 80C ,etc.. (4) Four 8 run side by side I/O interface P0 four P3, each mouth can use as introduction, may use as exporting too. (5) Two timer / counter, each timer / counter may set up and count in the way, used to count to the external incident, can set up into a timing way too, and can according to count or result of timing realize the control of the computer. (6) Five cut off cutting off the control (universal asynchronous receiver/transmitter (UART) ), is it realize one-chip computer or one-chip computer and serial communication of computer to use for. (8) Stretch oscillator and clock produce circuit, quartz crystal finely tune electric capacity need outer. Allow oscillation frequency as 12 megahertz now at most. Every the above-mentioned part was joined through the inside data bus .Among them, CPU is a core of the one-chip computer, it is the control of the computer and command center, made up of such parts as arithmetic unit and controller , etc.. The arithmetic unit can carry on 8 persons of arithmetic operation and unit ALU of logic operation while including one, the 1 storing devices temporarily of 8, storing device 2 temporarily, 8's accumulation device ACC, register B and procedure state register PSW, etc. Person who accumulate ACC count by 2 input ends entered of checking etc. temporarily as one operation often, come from person who store 1 operation is it is it make operation to go on to count temporarily , operation result and loop back ACC with another one. In addition, ACC is often regarded as the transfer station of data transmission on 8051 inside. The same as general microprocessor, it is the busiest register. Help remembering that agreeing with a expresses in the order. The controller includes the procedure counter, the order is deposited, the

相关文档
最新文档