《em78p156el 间接寻址的应用》由会员分享,可在线阅读,更多相关《em78p156el 间接寻址的应用(5页珍藏版)》请在金锄头文库上搜索。
1、 EM78P156EL 间接寻址的应用间接寻址的应用 义隆电子股份有限公司义隆电子股份有限公司 第一版第一版 2008年年11月月 Trademark Acknowledgments: IBM is a registered trademark and PS/2 is a trademark of IBM. Windows is a trademark of Microsoft Corporation. ELAN and ELAN logo are trademarks of ELAN Microelectronics Corporation. Copyright 2008 by ELAN M
2、icroelectronics Corporation All Rights Reserved Printed in Taiwan The contents of this specification are subject to change without further notice. ELAN Microelectronics assumes no responsibility concerning the accuracy, adequacy, or completeness of this specification. ELAN Microelectronics makes no
3、commitment to update, or to keep current the information and material contained in this specification. Such information and material may change to conform to each confirmed order. In no event shall ELAN Microelectronics be made responsible for any claims attributed to errors, omissions, or other ina
4、ccuracies in the information or material contained in this specification. ELAN Microelectronics shall not be liable for direct, indirect, special incidental, or consequential damages arising from the use of such information or material. The software (if any) described in this specification is furnis
5、hed under a license or nondisclosure agreement, and may be used or copied only in accordance with the terms of such agreement. ELAN Microelectronics products are not intended for use in life support appliances, devices, or systems. Use of ELAN Microelectronics product in such applications is not sup
6、ported and is prohibited. NO PART OF THIS SPECIFICATION MAY BE REPRODUCED OR TRANSMITTED IN ANY FORM OR BY ANY MEANS WITHOUT THE EXPRESSED WRITTEN PERMISSION OF ELAN MICROELECTRONICS. ELAN MICROELECTRONICS CORPORATION Headquarters: No. 12, Innovation Road 1 Hsinchu Science Park Hsinchu, Taiwan 308 T
7、el: +886 3 563-9977 Fax: +886 3 563-9966 http:/.tw Hong Kong: Elan (HK) Microelectronics Corporation, Ltd. Flat A, 19F., World Tech Centre 95 How Ming Street, Kwun Tong Kowloon, HONG KONG Tel: +852 2723-3376 Fax: +852 2723-7780 .hk USA: Elan Information Technology Group (USA) P.O. Box 601 Cupertino,
8、 CA 95015 USA Tel: +1 408 366-8225 Fax: +1 408 366-8225 Shenzhen: Elan Microelectronics Shenzhen, Ltd. 3F, SSMEC Bldg., Gaoxin S. Ave. I Shenzhen Hi-tech Industrial Park (South Area), Shenzhen CHINA 518057 Tel: +86 755 2601-0565 Fax: +86 755 2601-0500 Shanghai: Elan Microelectronics Shanghai, Ltd. #
9、23, Zone 115, Lane 572, Bibo Rd. Zhangjiang Hi-Tech Park Shanghai, CHINA 201203 Tel: +86 21 5080-3866 Fax: +86 21 5080-4600 EM78P156EL 间接寻址的应用间接寻址的应用 EM78P156EL的应用笔记的应用笔记 1 目目 录录 一、 相关寄存器 .2 1、 R0(间接地址寄存器)2 2、 R4(RSR)RAM 选择寄存器2 二、 使用步骤.2 三、 范例.2 EM78P156EL 间接寻址的应用间接寻址的应用 2 EM78P156EL的应用笔记的应用笔记 EM78P
10、156EL 间接寻址的应用间接寻址的应用 一、 相关寄存器一、 相关寄存器 1、 R0(间接地址寄存器间接地址寄存器) R0 并非一个实际工作的寄存器,而只作为间接寻址用。任何对 R0 进行操作的指令,实际上是存取由 RAM 选择寄存器 R4 所指定的 RAM内容。 2、 R4(RAM 选择寄存器选择寄存器) R4 寄存器各位定义如下: Bit 7 Bit 6:未用 。 Bit 5 Bit 0:在间接寻址方式中用于选择寄存器(地址: 00 3F)。 R4 在间接寻址时作为 RAM选择寄存器使用。注意:任何对 R0 进行操作的指令,实际上是存取由 R4 所指定的 RAM的内容。在间接寻址模式里,
11、R4 的 05位用来选择寄存器,其地址从 003FH。 二、 使用步骤二、 使用步骤 1. 设置间接寄存器R4的初始值; 2. 对寄存器R0进行操作。 如: MOV A, 0X20 ;设定A寄存器的值为0X20 MOV 0X04, A ;设定间接寻址寄存器(0X04)的内含值0X20 MOV A, 0X35 ;设定A寄存器的值为0X35 MOV R0, A ;将A的值送到指定的RAM地址中(RAM地址 ;0X20=0X35) 以上指令的执行结果为: 寄存器地址0X20内的值变为0X35 三、 范例三、 范例 ;* ;下面的范例实现对0X100X3F的RAM清零 ;* EM78P156EL 间接
12、寻址的应用间接寻址的应用 EM78P156EL的应用笔记的应用笔记 3 ;MCU:EM78P156EL ;Oscillator:Crystal 3.58MHz ;Clock: 2 ;WDT: Disable ;编译软件:WicePulse version 2.6081015 INCLUDE “EM78P156EL.INC“ ORG 0X00 JMP INITIAL ORG 0X50 INITIAL: MOV A, 0X10 MOV RSR, A ;RSR指至RAM中0X10的地址 MAIN: CLR R0 ;清除RSR指定地址的内容 INC RSR ;RSR指到下一个地址 MOV A,RSR AND A,0X3F JBS Z ;判断是否0x100x3F已清除 JMP MAIN JMP $