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

📄 c8051.h

📁 C8051F020的下载调试软件和下载线制作电路图。有兴趣做020的朋友可以参考参考。
💻 H
字号:



//////////////////////////////////////////////////////////////////////////
//定义下载线类型
//////////////////////////////////////////////////////////////////////////
#define ALTERABLASTER	0x00				//altera的byteblaster数据线	
#define PARALLELIII		0x01				//XILINX PARALLEL III 线缆
/*

	ALTERABLASTER
DB25-2 -------TCK
DB25-11-------TDO
DB25-3 -------TMS
DB25-8 -------TDI
DB25-15 ------GND

DB25-14 -------244OE

DB25-7 --------DB25-10  

	PARALLELIII
DB25-8 -------DB25-11,12;
DB25-5 -------74125 控制使能端
DB25-3 -------TCK
DB25-2 -------TDI
DB25-4 -------TMS
DB25-13-------TDO		;对于PC,输入

*/

  





//////////////////////////////////////////////////////////////////////////
//定义JTAG指令地址
//////////////////////////////////////////////////////////////////////////
// JTAG Instruction Register Addresses
#define		INST_LENGTH		16 // number of bits in the
// Instruction Register
#define		BYPASS			0xffff
#define		EXTEST			0x0000
#define		SAMPLE			0x0002
#define		RESET			0x2fff		// System RESET Instruction
#define		IDCODE			0x1004		// IDCODE Instruction address/HALT
#define		IDCODE_LEN		32			// number of bits in the ID code
#define		FLASHCON		0x4082		// FLASH Control Instruction address
//#define		FLCN_LEN		8			// number of bits in FLASHCON
#define		FLASHDAT		0x4083		// FLASH Data Instruction address
//#define		FLD_RDLEN		10			// number of bits in an FLASHDAT read
//#define		FLD_WRLEN		8			// number of bits in an FLASHDAT write
#define		FLASHADR		0x4084		// FLASH Address Instruction address
//#define		FLA_LEN			16			// number of bits in FLASHADR

#define		FLASHSCL		0x4085		// FLASH Scale Instruction address
//#define		FLSC_LEN		8			// number of bits in FLASHSCL



//////////////////////////////////////////////////////////////////////////
//定义CPU类型
//////////////////////////////////////////////////////////////////////////

#define C8051F020		0x3243						//020'ID code
#define C8051F120		0x7243				







//////////////////////////////////////////////////////////////////////////
//一般C8051JTAG口定义
//1-VCC	2-GND
//3-GND	4-TCK
//5-TMS	6-TDO
//7-TDI	8-NC
//9-GND	10-NC
//JTAG---C2接口
//1-VCC	2-GND
//3-GND	4-C2D
//5-RST	6-C2D
//7-C2CK8-NC
//9-GND	10-NC
//修改Byteblaster 的 TDI
//////////////////////////////////////////////////////////////////////////
//C2 interface
// FLASH information
#define	FLASH_SIZE	8192				// FLASH size in bytes
#define NUM_PAGES FLASH_SIZE/512		// Number of 512-byte FLASH pages
// C2 status return codes
#define INVALID_COMMAND		0x00
#define COMMAND_FAILED		0x02
#define COMMAND_OK			0x0D
// C2 interface commands
#define GET_VERSION			0x01
#define BLOCK_READ			0x06
#define BLOCK_WRITE			0x07
#define PAGE_ERASE			0x08
#define DEVICE_ERASE		0x03
// C2 Registers
#define FPDAT				0xB4
#define FPCTL				0x02
#define DEVICEID			0x00
#define REVID				0x01
// Program MACROS
#define Poll_OutReady	while(!(C2_ReadAR()&0x01))
#define Poll_InBusy		while((C2_ReadAR()&0x02))
#define StrobeC2CK		C2CK = LOW; C2CK = HIGH
//#define C2D_DriverOn	PRT1CF |= 0x02	// Configures C2D pin as
// push-pull output
//#define C2D_DriverOff PRT1CF &= ~(0x02);P1 |= 0x02 // Configures C2D pin as
// open-drain input

⌨️ 快捷键说明

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