⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdttool.h

📁 keil无2k限制
💻 H
字号:

//*************************************************************************
// File Name:        Jdttool.H
// Author:           Jianfu Luo
// Created:          19 Dec 2002
// Modified:
// Revision: 		1.0
//
//*************************************************************************

/*以下程序定义了以下的C语句,如要使用JDT-52XP内的IXRAM和P4,请使用以下语句
DisableInterRam		:禁止内部XRAM
EnableInterRam		:使能内部XRAM
setb_P4x			:置位P4x位
clr_P4x				:清除P4x位
in_P4x				:测试P4x位  如 if( in_P4x ) {  ......  }
--------------------------------------------------------------------------*/

#ifndef __JDTTOOL_H__
#define __JDTTOOL_H__

/*-----------------------------------------------------------------------
为了简化你的程序,请使用以下定义存取内部XRAM和P4端口                   
在仿真器内部调试程序时请加入行:                                       
		#define		ISDebugIn_JDT52XP
要生成烧片代码则删除以上行即可                                         
//----------------------------------------------------------------------*/

#define		ISDebugIn_JDT52XP	//程序调试专用语句,在脱离开发系统前请删除此行,
								//再次Build你的程序

#ifdef		ISDebugIn_JDT52XP
//定义P4  IO 端口
sfr			_PORT4=0xa6;
//禁止内部XRAM
#define		DisableInterRam		_PORT4|=0x40
//使能内部XRAM		
//使用 EnableInterRam  后,可用  MOVX...指令时P0/P2/WR/RD端口不会输出数据/地址信息            
//如要使用  MOVX...  指令输出在P0和P2口输出数据/地址信息,请使用  DisableInterRam      
#define		EnableInterRam		_PORT4&=0xdf	

//请使用	MOVX	a,@dptr/@dptr,a   指令存取内部XRAM
//同样也可使用   movx   a,@ri/@ri,a    ,但不推荐这样,因为JDT52XP有64K的IXRAM

//内部P4端口不支持位操作,清使用    P4寄存器
//定义
sfr			P4=0xa6;
#define		in_P40				(_PORT4&0x01)
#define		in_P41				(_PORT4&0x02)
#define		in_P42				(_PORT4&0x04)
#define		in_P43				(_PORT4&0x08)

#define		setb_P40			_PORT4|=0x01
#define		 clr_P40			_PORT4&=0xfe
#define		setb_P41			_PORT4|=0x02
#define		 clr_P41			_PORT4&=0xfd
#define		setb_P42			_PORT4|=0x04
#define		 clr_P42			_PORT4&=0xfb
#define		setb_P43			_PORT4|=0x08
#define		 clr_P43			_PORT4&=0xf7

#else		//not define ISDebugIn_JDT52XP

//以下是  W78LE58B  的例子   你要根据你的MCU进行更改
sfr			CHPCON		0xbf;
//请加入你的  禁止内部XRAM定义
#define		DisableInterRam		CHPCON&=0xef
//请加入你的  使能内部CRAM定义
#define		EnableInterRam		CHPCON|=0x10

//W78le58 内部P4
sfr			P4				0xd8;

sbit		P40				0xd8;
sbit		P41				0xd9;
sbit		P42				0xda;
sbit		P43				0xdb;

#define		setb_P40		P40=1
#define		 clr_P40		P40=0
#define		setb_P41		P41=1
#define		 clr_P41		P41=2
#define		setb_P42		P42=1
#define		 clr_P42		P42=0
#define		setb_P43		P43=1
#define		 clr_P43		P43=0

#define		in_P40			(P40)
#define		in_P41			(P41)
#define		in_P42			(P42)
#define		in_P43			(P43)

#endif	//end #ifdef ISDebugIn_JDT52XP

#endif	//end #ifdef __JDTTOOL_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -