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

📄 main.c

📁 周立功2103开发板CD资料
💻 C
字号:
#define IN_MAIN
#include "config.h"
#include "Enhance_GPIO.h"					//使用增强性GPIO
#pragma import(__use_no_semihosting_swi)	//don't delete this line

#define	BEEP	(1 << 7)		//P0.7控制蜂鸣器,低电平鸣叫
#define	KEY1	(1 << 14)		//P0.14
/*********************************************************************************************************
** Function name:	IRQ_Exception
** Descriptions:	interrupt exceptional handler , change it as needed
**					don't delete this function 
********************************************************************************************************/
void  IRQ_Exception(void)
{
}
/*********************************************************************************************************
** 函数名称:Main()
** 函数功能:跳线JP1短接,蜂鸣器鸣叫;跳线JP1断开,蜂鸣器停止鸣叫。
** 说明:跳线JP9短接,JP4断开。复位时JP1断开。
********************************************************************************************************/
void  Main(void)
{
	TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA);	// don't delete
	while((PLLSTAT & (1 << 10)) == 0);					// can delete
    
    P0_GPIOInit(BEEP | KEY1,1);		//设置P0.7为GPIO输出模式
	P0_GPIODir(KEY1,0);				//P0.14设置为GPIO输入模式
    while(1)
    {
		if((Read_P0() & KEY1) == 0)	//P0.14为低时,控制蜂鸣器鸣叫
			P0_GPIOClr(BEEP);
  		if((Read_P0() & KEY1) != 0)	//P0.14为高时,蜂鸣器停止鸣叫
			P0_GPIOSet(BEEP);
   	}
}
/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

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