电气工程外文翻译_第1页
电气工程外文翻译_第2页
电气工程外文翻译_第3页
电气工程外文翻译_第4页
电气工程外文翻译_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、理工学院毕业设计(论文)外文资料翻译专 业: 电气工程及其自动化 姓 名: 廉宏扬 学 号: 11L0851084 外文出处: Microcontrollers in Practice 附 件: 1.外文资料翻译译文;2.外文原文。 指导教师评语: 签名: 年 月 日附件1:外文资料翻译译文8.3_ 写一个字节EEPROM该E2W(EEPROM写入)子程序,下面列出。假设:E2W LDAB #$02 ; BYTE=O, ERASE=O, EELAT=1STAB PPROG STAA O,X ;写操作门闩的地址和数据 LDAB #$03 ;使 EEPGM=1STAB PPROG ;开始Vpp的电

2、荷泵JSR DLY10 ;等待10毫秒CLR PPROG ;停止Vpp的并返回到读模式RTS ;返回到主程序*在与写入操作的目标地址相关联BPROT所述位被清除,即目的地不是写保护。*目的地字节先前已擦除。*目的地字节的地址被放置在X中*数据字节将被写入在EEPROM置于A.如果ERASE=1和 BYTE =0,设置PPROG将启动对整个EEPROM存储器擦除序列。所谓的批量擦除。阅读EEPROM写或擦除操作正在进行中(EELAT = 1)返回错误数据。没有硬件机制来防止这种类型的错误。8.3.3配置寄存器在CONFIG寄存器由8 EEPROM单元,组织成位于MCU的I / O寄存器块寄存器。

3、在CONFIG寄存器可以被删除或者只是像任何其他EEPROM的位置编程,是68HC11F1的CONFIG寄存器的结构如下:*NOCOP= L禁用COP(计算机正常运行)看门狗,*ROMON=1使内部ROM。* EEON= L启用内部EEPROM。在HCll组织的一些单元允许EEPROM块存储器映射中的任何4K边界开始重新映射,为了达到这个目的,最显著四位的配置寄存器,调用EE3:EE2:EE1:EE用于定义最显著四个比特EEPROM的地址。例如,如果EE3:EE2:EE1:EE = 0:1:0:1,则对EEPROM的起始地址是$ 5000。 8.4在AVR微控制器的EEPROM存储器

4、  有在EEPROM存储器中的AVR微控制器实现的,相比HC11的方式显著差异。而在HC11,EEPROM存储器是在存储器映射中直接可见的,并且可以被用作数据存储器或作为程序存储器,用于接入到EEPROM看起来更像从外围接口访问数据的AVR处理器。8.4.1EEPROM作为接口的寄存器四个寄存器控制访问EEPROM . .这些都是叫EEARH EEARL.EEARL EECR。* EEARH - EEARL(EEPROM地址)一起形成一个16位寄存器实现EEPROM地址空间。* EEDR-EEPROM数据寄存器。这是用于访问EEPROM数据, 在读取和写入操作。* EECR

5、-EEPROM控制寄存器包含了控制位的读写操作。EECR具有以下结构。 * EEMWE-EEPROM主允许写入。这一点EEPROM数据提供了一种保护机制,在项目失控。EEMWE由软件设定,但是是由硬件自动清除,在四个主要系统时钟周期。在这四个周期的间隔,可以启动EEPROM写操作,通过编写EEWE 1。试图写入EEWE EEMWE = 0时无效果。当电源电压EEWE是通过硬件。因此,建议调查EEWE,决定写操作结束。* EERE-EEPROM读启用,这一点选择的访问类型EEPROM,EERE = 1表示一个读操作,而EERE = 0表示写操作。8.4.2软件Routones读取和写入EEPRO

6、M读一个字节从EEPROM通过测试EEWE在R16的下列程序序列中读取从由寄存器Z的指示的地址它启动一个EEPROM字节,以确定该接口已经准备好.如果 EEWE=0, Z的内容被传输到EEARH-EEARL,则控制世界写入EECR有EERE=1(读操作)。该EEPROM数据现在可读EEDR。 EERead: SBIC EECR,EEWE ;确保 EEWE=0 RJMP EERead OUT EEARH,ZH ;在 EEARH-EEARL写地址 OUT EEARL,ZL LDI R16,$01 ;EERE=1 - 读操作 OUT EECR,R16 IN R16,EEDR ;读 R1

7、6数据 RET写一个字节EEPROM下面描述的子程序写到指定的字节在R16EEPROM地址。执行下列操作顺序:l*检查EEWE确定接口是否准备好了。l*写Z EEARH:EEARL。l*写R16 EEDR。l*EEWME设置。l*EEWE开始实际的写操作。这是程序,执行这些操作;EEWrite: SBIC EECR,EEWE ;确保 EEWE=0 RJMP EEWrite OUT EEARH,ZH ;在 EEARH-EEARL写地址 OUT EEARL,ZL OUT EEDR,R16 ;数据写入 EEDR CLI ;禁止中断 LDI R16,$O4 ;EEMWE=1 OUT EE

8、CR,R16 LDI R16,$02 ;EEWE=1 OUT EECR,R16 SEI ;允许中断 RET 不是启动实际写入命令之前,该程序禁用所有interrupts.The原因是,步骤4执行和5之间发生会耽误时EEWE设置超出四个周期的极限的时刻中断EEMWE置后。在步骤5中写入EEWE会发现由硬件EEWME清零,整个的写操作将失败9.1在本章本章包含的描述一个简单的基于68 hc11f1单片机开发板。和相关软件工具,主要以允许用户编写和测试软件应用单片机。9.2描述的硬件模块对于微控制器的研究开发系统包括硬件模块和一组软件实用程序(交叉汇编器,编译器等)与来自制造商的数据表和应用笔记。随

9、着,这使用户可以达到一个清晰的认识的资源和该特定的微控制器的能力,并编写和测试软件应用程序。本文提供的模块是最简单的一个可能的。它是建立在摩托罗拉68 hc11f1单片机,操作与外部EEPROM作为AT28C256,轻易可重复编程的10000倍左右。可以编写测试程序直接使用标准的商业AT28C256 EPROM程序。68年hc11f1单片机剂量没有内部程序内存它是为了工作与外部ROM扩展模式。为此,单片机可以提供四个芯片选择信号外部内存或I / O设备。这些信号激活的方式,他们的极性和相对优先级软件控制。硬件模块的原理提出了Fig.9.1。有极少的外部元件,除了微控制器。程序存储器被直接连接到

10、所述地址和数据总线,ANF芯片选择信号CSPROG由微控制器提供,而无需外部地址译码器。外部时钟电路是使用晶体Q1(8兆赫典型),电容C5和C6(15-22pF)和电阻器R1(为1-10m)来实现。这种类型的振荡电路是典型的HC11的所有家庭成员。复位电路包括连同电阻R2,R3,R4 capacitorC9和连接器JP1晶体管T1。在上电时,电容器C8开始通过R2充电,供给到T1.这个基极电流饱和晶体管的时间间隔可比R28C9,产生一个低电平有效脉冲在微控制器的RESET线。当JP1的端子短路时,发生类似的过程,这是模块的手动复位的手段。C2的电路(MAX232)连同电容器C1,C2,C3和C

11、4的实施呈现的典型RS232接口。控制信号MODB和外部中断IRQ和XIRQ使用10 k电阻。测试单片机的I / O线被带到三个为header类型的连接器SV1 SV2.SV3。模块驱动的直流或交流适配器, 能够提供9-12V电流为250mA供电。通过桥式整流器输入电压B1的电压调节器IC4(7805)产生的+ 5 v电源电压。9.3组装和测试模块所有的项目。本节中的配有详细的原理图和印刷电路板的图纸上可用所附CD. PCB的附图描述与4.11从CadSoft公司创建的。该软件的免费版本可以从CadSoft公司免费下载,使用户可以查看,编辑和打印所有的原理图,在这本书中描述的项目的PCB图。这

12、种CAD软件的主要优点是,这是很容易学习,和免费软件版本,尽管有一些限制,仍允许用户设计相当复杂的基于微控制器的电路。大多数公司制造的定制印刷电路板接受鹰4.11中创建的图纸,每印刷电路板平方分米的成本是合理的。然而,在这个特殊的情况下,该电路是如此简单,它可以容易地实现关于使用导线缠绕技术中的原型板。建议使用合适的IC插座的所有芯片,除了IC4。参照图9.2用于PCB的一个可能的组件布局。    一旦你的模块组装。按照这个测试序列:1.应用能力模块。而不必在插座插入集成电路。2.检查+5 V电压上的每个插槽。3.通过测量电压在T1的集电极,当短路被施加

13、到JPI的终端检查复位电路。在这一点上的电压下降到接近0V。而没有短路它保持接近V值。4.将芯片插入插座,接通电源模块。用示波器检查引脚40F单片机电子时钟。如果没有一个示波器,使用电压表来测量T1的集电极的RESET信号。如果振荡器不能操作,微控制器的时钟监控电路将迫使该行逻辑0。5.如果一切都是好的,安装cross-assembler,描述在接下来的段落和组装一个简单的软件的例子,像介绍X9.1的这一章。6.使用一个商业EPROM程序,程序AT28C256内存cross-assembler创建的二进制文件,并检查模块的预期行为。9.4描述的软件组件免费软件交叉汇编摩托罗拉的HC11系列提供

14、的。所谓AS11.EXE,是非常简单的,有许多不足之处。其中,最重要的是:它不允许INCLUDE指令,从而迫使用户写在一个文件中的所有的源代码。这可以是非常好的.例如,摩托罗拉(BUFFALO)提供的免费显示器的源代码有超过5000行代码。很显然,这几乎是不可能调试这样一个程序,如果有什么不顺心。另一方面,如果汇编包括INCLUDE,源代码可被组织在较小的,可重复使用。的代码块。放置在不同的文件中,根据一些用户选择的标准,例如TIMER.ASM,SCI.ASM,OUTPUT.ASM,等等。所有这些软件模块由一个主模块调用,使用INCLUDE指令。*它不允许宏定义,从而严重地限制了用户的自由定制

15、他/她的编程环境。由于这些原因,我们选择使用不同的免费交叉汇编,被称为ASHC11,由彼得·加尔加诺创建。除了INCLUDE和宏定义,这种交叉汇编有许多额外的功能。请参阅附录B2关于如何下载这个软件的详细信息。入门第一步,安装交叉汇编ASHC11是DOS应用,并且不需要任何特殊的安装过程。 ASHC1l:要安装它,硬盘驱动器的名称C上创建一个文件夹。并解压缩下载的存档到这个文件夹。然后创建一个DOS窗口。其工作目录中的C: ASHCl。要做到这一点,在Windows9.x中按下鼠标的右按钮的桌面上,并且,从呈现选项列表。选择新建。那么快捷方式。在预留空间来定义关联到新的快捷方式的命令

16、行。键入“命令.COM”,然后按Next按钮。和完成。      这个操作的效果是一个新出现的快捷方式命名为“MS-DOS方式”在桌面上。要完成这项工作。指定该工作目录。附件2:外文原文8.3_ Wdting a Byte to EEPROMThe E2W (EEPROM write) subroutine,listed below. assumes that:E2W LDAB #$02 ; BYTE=O, ERASE=O, EELAT=1STAB PPROG STAA O,X ;write operation to latch th

17、e ; address and dataLDAB #$03 ;make EEPGM=1STAB PPROG ;start Vpp charge pumpJSR DLY10 ;wait 10 msCLR PPROG ;stop Vpp and return to read ; modeRTS ;return to main program * The bit in BPROT associated with the destination address of the write operation is cleared, i.e. the destination is not write pr

18、otected. * The destination byte has been previously erased.* The address of the destination byte is placed in X.* The data byte to be written in the EEPROM is placed in A. If ERASE = 1 and BYTE = 0, setting PPROG will initiate an erase sequence on the entire EEPROM memory. called BULK ERASE. 8.3.3 T

19、he CONFIG RegisterThe CONFIG register consists of eight EEPROM cells, organized as a register located in the I/O register block of the MCU. The CONFIG register can be erased or programmed just like any other EEPROM location, The structure of the CONFIG register of 68HC11F1 is as follows:*NOCOP=l dis

20、ables the COP (Computer Operating Properly) warchdog,*ROMON=1 enables the internal ROM.*EEON=l enables the internal EEPROM.Some members of the HCll family allow remapping of the EEPROM bloclc to the beginning of any 4K boundary in the memory map,To this purpose ,the most singnificant four bits of th

21、e CONFIG registers,callsEE3:EE2:EE1:EE are used to define the most significant four bits of the address of the EEPROM. For example ,if EE3:EE2:EE1:EE =0:1:0:1,then the starting address of the EEPROM is $5000.8.4 THE EEPROM Memory of the AVR Microcontrollers There are significant differences in the w

22、ay the EEPROM memory is implemented in AVR microcontrllers,compared to HC11. While in HC11,the EEPROM memory is directly visible in the memory map, and can be used as data memory or as program memory, for the AVRs the access to the EEPROM looks more like accessing data from a peripheral interface.8.

23、4.1 The Registers of the Interface with the EEPROM Memory Four registers control the access to the EEPROM.These are named EEARH , EEARL.EEARL and EECR.*EEARH - EEARL (EEPROM Address Regisrer Hi,gh/Low) form together a 16-bit register that implements the EEPROM address space.*EEDREEPROM Data Register

24、.This is used to access the EEPROM data,during the read and write operanons.*EECREEPROM Control Register contains the control bits for the write and read operations.EECR has the following structure. * EEMWE-EEPROM Master Write Enable. This bit provides a protection mechanism of the EEPROM data ,in c

25、ase of program runaway.The EEMWE is set by software,but is automatically cleared by hardware, after four cycles of themain system clock.In this interval of four cycles,it is possible to initiate a write operation to the EEPROM,by writing 1 to EEWE.Attempts to write to EEWE when EEMWE=0 haveno effect

26、.EEWE is cleared by hardware when the supply voltage. Therefore,it is recommended to poll EEWE, to determine the end of the write operation.*EERE-EEPROM Read Enable,This bit selects the access type to the EEPROM,EERE=1 indicates a read operation, while EERE=0 indicates a write operation.8.4.2 Softwa

27、re Routones to Read and Write EEPROM Reading a Byte from EEPROMThe following program sequence reads in R16 an EEPROM byte from the address indicated by register Z. It starts by testing EEWE to determine if the interface is ready.If EEWE=0 the contents of Z are transferred to EEARH-EEARL, then

28、 a control world is written to EECR having EERE=1(read operation).The EEPROM data is now readable in EEDR. EERead: SBIC EECR,EEWE ;确保 EEWE=0 RJMP EERead OUT EEARH,ZH ;write address in EEARH-EEARL OUT EEARL,ZL LDI R16,$01 ;EERE=1 - read operation OUT EECR,R16 IN R16,EEDR ;read data in R16 RET

29、Writing a Byte To EEPROM The subroutine described below writes the byte in R16 to the EEPROM address specified by Z.The following sequence of operation is performed:*Check EEWE to determine if the interface is ready.*Write Z to EEARH:EEARL.*Write R16 to EEDR.*Set EEWME.*Set EEWE to start the actual

30、write operation.Here is program that executes these operations;EEWrite: SBIC EECR,EEWE ;make sure EEWE=0 RJMP EEWrite OUT EEARH,ZH ;write address in EEARH-EEARL OUT EEARL,ZL OUT EEDR,R16 ;write data to EEDR CLI ;disable interrupts LDI R16,$O4 ;EEMWE=1 OUT EECR,R16 LDI R16,$02 ;EEWE=1 OUT EECR,R16 SE

31、I ;enable interrupts RET Not that before launching the actual write command, the program disables all interrupts.The reason for this is that an interrupt occurring between the execution of steps 4 and 5 would delay the moment when EEWE is set beyond the limit of four cycles after EEMWE is set. Writi

32、ng EEWE in step 5 would find EEWME cleared by hardware, and the whole write operation would fail.9.1 In this ChaperThis chaper contains the description of a simple development board based on the microcontroller 68HC11F1.and related software utilities,intented to allow the user to write and test soft

33、ware applications for this microcontroller.9.2 Description of the Hardware ModuleA development system for the study of a microcontroller comprises a hardware module and a set of software utilities (cross-assembler,compiler,etc).Along with the data sheets and application notes from the manufacturer,t

34、his allows the user to reach a clear understanding of the resources and capabilities of that specific microcontroller,and to write and test software applications for it. The module presented here is one of the simplest possible.It is built around the Motorola 68HC11F1 microcontroller, operating with

35、 an external EEPROM memory AT28C256, easily reprogrammable around 10000 times.Test programs can be written directly to AT28C256 using a standard commercial EPROM programmer. The 68HC11F1 microcontroller dose not have internal program memory it is designed to work with external ROM in expanded mode .

36、 For this purpose, the microcontroller can provide up to four chip select signals for external memory or other I/O devices. The way these signals activate,their polarity and relative priority are software controlled. The schematic of the hardware module is presented in Fig.9.1.There are very few ext

37、ernal components ,besides the microcontroller. The program memory is connected directly to the address and data buses, anf the chip select signal CSPROG is provided by the microcontroller, without the need of an external address decoder.The external clock circuit is implemented using the crystal Q1

38、(8 MHz typical),the capacitor C5 and C6 (15-22pF) and the resistor R1(1-10M). This type of oscillator circuit is typical of all HC11 family members.The RESET circuit comprises the transistor T1 along with resistors R2, R3, R4,capacitorC9 and connector JP1. At power-up, the capacitor C8 starts chargi

39、ng through R2, feeding current to the base of T1.This saturates the transistor for a time interval comparable to R28C9,generating an active LOW pulse on the RESET line of the microcontroller. A similar process occurs when the terminals of JP1 are short-circuited, providing a means for manual reset o

40、f the module.The IC2 circuit (MAX232) along with capacitors C1,C2,C3,and C4 implement the typical RS232 interface presented in Chep.3.The control signals MODA,MODB and the external interrupts IRQ and XIRQ are pulled up to Vcc using four 10K resistors.The test of the I/O lines of the microcontroller

41、are brought to three header-type connectors SV1,SV2.SV3.The module is powered from a DC or ac adapter, able to deliver 9-12V at 250mA. The input voltage is applied through the bridge rectifier B1 to the voltage regulator IC4(7805) that generates the +5V supply voltage.9.3 Assembling and Testing the

42、ModuleAll the projects. described in this section come with detailed schematics and printed circuit board drawings available on the accompanying CD.The PCB drawings arec reated with Eagle 4.11 from CadSoft. A freeware version of this software is available for free download from Cadsoft, so that the

43、user can view,edit,and print all the schematics and the PCB drawing of the projects described in this book. The major advantage of this CAD software is that it is very easy to learn, and the freeware version, despite some limitations, still allows the user to design prerty complex microcontroller ba

44、sed circuits. Most companies manufacturing custom printed circuit boards accept drawings created with Eagle 4.1 1, and the cost per square decimeter of printed circuit board is reasonable. However, in this particular case, the circuit is so simple that it can be easily realized on a prototyping boar

45、d using the wire wrap technique. It is recomended to use appropriate IC sockets for all ICs, except IC4. Refer to Fig. 9.2 for a possible component layout of the PCB. Once you have the module assembled. follow this test sequence:l. Apply power to the module. without having the ICs inserted in the so

46、ckets.2. Check the +5 V voltage on every socket.3. Check the RESET circuit by measuring the voltage in the collector of Tl, When a short-circuit is applied to the terminals of JPI. the voltage on this point drops near O V. while without short-circuit it stays near the V value.4. Insert the ICs into

47、the sockets and apply power to the module. With an oscilloscope check the E clock on pin 4 0f the microcontroller. If you don't have an oscilloscope, use a voltmeter to measure the RESET signal on the collector of Tl. If the oscillator fails to operate, the clock monitor circuit of the microcont

48、roller will force this line to logic zero.5.If everying is alright,install the cross-assembler,as described in the next paragraph and assemble a simple software example,like the presented in this chapter in exercise X9.1.6.Using a commercial EPROM programmer, program the AT28C256 memory with the bin

49、ary file created by the cross-assembler,and check the expected behavior of the module.9.4 Description of the Software Components The freeware cross-assembler offered by Motorola for the HC11 family. Called AS11.EXE,is extremely simple and has many weak points. Among them,the most important are:* It does not allow the INCLUDE directive, thus forcing the user to write all the source code in a single file. This can be extremely inconvenient.For example, the source code for the free monitor offer

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论