用Haawking-IDE点亮一个Led 贴主:zhangyaxiao 1. 建立工程 1) 打开软件,选择好保存路径后点击launch。 2) 点击HaawkingProject,然后Next。 3) 新建工程,选择027,FLASH. 4) 完成建立。 2.编写程序 //初始化 void LED_Init() { EALLOW;//打开寄存器写保护 GpioCtrlRegs.GPAMUX1.bit.GPIO3= 0; // GPIO GpioCtrlRegs.GPADIR.bit.GPIO3= 1; // Output GpioDataRegs.GPASET.bit.GPIO3= 1; // 输出高电平 GpioDataRegs.GPACLEAR.bit.GPIO3= 1; // 输出低电平 EDIS;//关闭寄存器写保护 } //主函数 int main(void) { InitSysCtrl(); LED_Init(); while(1){ EALLOW;//打开寄存器写保护 GpioDataRegs.GPASET.bit.GPIO0 = 1; // 输出高电平 DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; // 输出低电 DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms DELAY_US(30000); //30000us = 30ms EDIS; // 关闭寄存器写保护 } return 0; } 二.烧录程序 1.在左侧选择文件,右击选择Rebuild Project。
2.点击菜单栏的小甲虫图标进行编译。
3.选择当前文件---Debug
|