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

📄 __hal.c

📁 C语言版的USB单片机固件源代码
💻 C
字号:
//===================================================================//
//     Project Name : ZBoard
//      Module Name : Master Firmware Program
//     Product Type : License
//      OS/Dev Tool : AT89C52, uVision 2
//  Original Author : Ray Yang
//     Organization : YBWork.com
//    Original Date : July, 25, 2001
//             Addr : Room 402, No. 131, Meilong No. 9
//              TEL : 86-21-54630718
//            EMail : rayyang2000@yahoo.com
//          Website : http://www.ybwork.com
//		  Copyright : Copyright (L) YBWork.com, 2001
//         Comments : 
//                    
//					<< History >> 
//					July, 25, 2001		The first release
//===================================================================//

#include "ZBoard.H"
#include "HAL.H"
#include "USBD12.H"

void outportb(unsigned short nPort, unsigned char nVal)
{
#ifdef PARALLEL_BUS
	unsigned char xdata *exAddress;
	exAddress = nPort;
	*exAddress = nVal;
#else
	P1 &= 0xf1;	// Enable D12
	IC_D12_A0 = nPort & 0x01 ? 1 : 0;
	IC_D12_WR = 0;
	P0 = nVal;
	IC_D12_WR = 1;
	P1 |= 0x0e;	// Disable D12
#endif

}

unsigned char inportb(unsigned short nPort)
{
	unsigned char nVal;
#ifdef PARALLEL_BUS
	unsigned char xdata *exAddress;
	exAddress = nPort;
	nVal = *exAddress;
#else
	P1 &= 0xf1;	// Enable D12
	IC_D12_A0 = nPort & 0x01 ? 1 : 0;
	IC_D12_RD = 0;
	nVal = P0;
	IC_D12_RD = 1;
	P1 |= 0x0e;	// Disable D12
#endif

	return nVal;
}

void Delay(unsigned char nFactor)
{
	unsigned char i;

	for(i=0; i<nFactor; i++)
		i=i;

}

void DelayMs(unsigned char nFactor)
{
	unsigned char i;

	for(i=0; i<nFactor; i++)
		Delay(2);
}



⌨️ 快捷键说明

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