EM78P159N
R-Option功能的应用
义隆电子股份有限公司
第一版 2009年06月
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 Microelectronics 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 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 inaccuracies 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 furnished 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 supported 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 Tel: +886 3 563-9977 Fax: +886 3 563-9966 http://www.emc.com.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 elanhk@emc.com.hk 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
USA:
Elan Information Technology Group (USA) P.O. Box 601
Cupertino, CA 95015 USA
Tel: +1 408 366-8225 Fax: +1 408 366-8225
Shanghai:
Elan Microelectronics Shanghai, Ltd.
#23, Zone 115, Lane 572, Bibo Rd. Zhangjiang Hi-Tech Park Shanghai, CHINA 201203 Tel: +86 21 5080-3866 Fax: +86 21 5080-4600
EM78P159N
R-option功能的应用
目 录
一、 相关寄存器...............................................................................................................2
1、IOCE(WDT控制寄存器)..............................................................................................2
二、 使用步骤...................................................................................................................2 三、 使用举例...................................................................................................................2
EM78P159N应用笔记
? 1
EM78P159N
R-option功能的应用
EM78P159N R-option功能的使用
一、 相关寄存器
1、 IOCE(WDT控制寄存器)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
WDTE EIS - ROC PSWE PSW2 PSW1 PSW0
Bit 4(ROC):ROC位用于R-option功能
1:使能R-option功能 0:禁止R-option功能
二、 使用步骤
1、 P5.0、P5.1需外接小于430K的下拉电阻 2、 使能R-option功能
三、 使用举例
;***************************************** ;根据P5.0、P5.1输入状态点亮不同的LED ;***************************************** ;MCU:EM78P159N ;Oscillator: IRC 4MHz ;Clock: 2 ;CYES:2cycle ;WDT: Disable
;编译软件: WicePulse version 2.7081231
INCLUDE \ REG
2 ?
== 0x10 ;保存P5.0、P5.1状态寄存器
ORG JMP ORG
0x00 INITIAL 0x50
EM78P159N应用笔记 INITIAL:
EM78P159N
R-option功能的应用
CLRA MOV IOW MOV IOW MOV IOW
PORT6,A IOC6
;PORT6输出低 ;PORT6设为输出
A,@0XFF IOC5
;PORT5设为输入
A,@0B00011111 IOCE
;启用R-option功能
MAIN:
MOV XOR JBC JMP JMP
A, REG A, @0x02 Z
;判断是否满足条件3,满足则跳到分支程序3 ;不满足条件3则继续判断
MOV XOR JBC JMP
A, REG A, @0x01 Z
;判断是否满足条件2,满足则跳到分支程序2 ;不满足条件2则继续判断
MOV AND MOV MOV IOW MOV IOW
A,PORT5
;读出PORT5以取得P5.0、P5.1的R-option引脚状态
A,@0B00000011 REG,A
;保存P5.0、P5.1电平状态
A,@0B00000000 IOCE
;禁止R-option功能
A,@0B00000000 IOC5
;P5.0、P5.1设为输出
;后PORT5可做为普通I/O口使用分支检测程序
MOV JBC
A, REG Z
;判断是否满足条件1,满足则跳到分支程序1 ;不满足条件1则继续判断
JMP Case1
Case2
Case3 Case4
;除以上三种条件外,则跳至分支程序4
;用户程序1
CASE1:
BS
PORT6,1
? 3
EM78P159N应用笔记
EM78P159N R-option功能的应用
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)