你这么一说,又仔细看了一眼开发板。
真的有点紫铜的颜色啊
点灯继续:
在官方例子上进行修改,添加管脚定义,添加一个delay函数,具体如下:
//----------------------------------------------------------------------------- // EFM8BB52_Blinky.c //----------------------------------------------------------------------------- // Copyright 2021 Silicon Laboratories, Inc. // http://developer.silabs.com/legal/version/v11/Silicon_Labs_Software_License_Agreement.txt // // Program Description: // // This program flashes the red/green/blue LED on the EFM8BB52 PK board about // five times a second using the interrupt handler for Timer2. // // Resources: // SYSCLK - 24.5 MHz HFOSC0 / 8 // Timer2 - 5 Hz interrupt // P1.4 - LED0 // //----------------------------------------------------------------------------- // How To Test: EFM8BB52 Explorer Kit //----------------------------------------------------------------------------- // 1) Connect the EFM8BB52 Explorer Kit to a PC using a mini USB cable. // 2) Compile and download code to the EFM8BB52 Explorer Kit board. // In Simplicity Studio IDE, select Run -> Debug from the menu bar, // click the Debug button in the quick menu, or press F11. // 3) Run the code. // In Simplicity Studio IDE, select Run -> Resume from the menu bar, // click the Resume button in the quick menu, or press F8. // 4) The LED0 should blink at approximately 5 Hz. // // Target: EFM8BB52 // Tool chain: Generic // // Release 0.1 (RN) // - Initial Revision // //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #include <SI_EFM8BB52_Register_Enums.h> #include <InitDevice.h> #include <SI_EFM8BB52_Register_Enums.h> //----------------------------------------------------------------------------- // Pin Definitions //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // SiLabs_Startup() Routine // ---------------------------------------------------------------------------- // This function is called immediately after reset, before the initialization // code is run in SILABS_STARTUP.A51 (which runs before main() ). This is a // useful place to disable the watchdog timer, which is enable by default // and may trigger before main() in some instances. //----------------------------------------------------------------------------- void SiLabs_Startup (void) { // Disable the watchdog here } SI_SBIT(LED0, SFR_P1, 4);// 这个地方定义led0为p1.4,直接命名为led0 void delay(unsigned int xms) //简单做个delay //xms代表需要延时的毫秒数 { unsigned int x,y; for(x=xms;x>0;x--) for(y=110;y>0;y--); } //----------------------------------------------------------------------------- // Main Routine //----------------------------------------------------------------------------- void main (void) { enter_DefaultMode_from_RESET(); //IE_EA = 1; // Enable global interrupts while (1) { LED0 = !LED0; delay(1000); } } // Spin forever
打赏帖 | |
---|---|
【Zephyr】MCXN947 Zephyr 开发入门适配shell被打赏20分 | |
【我要开发板】6.联合MATLAB记录数据被打赏50分 | |
【瑞萨RA2E1开发板】:使用ADC功能实现位移传感器采集方案被打赏20分 | |
【nRF7002DK】基于sht30的温湿度计被打赏20分 | |
【nRF7002DK】日志打印被打赏20分 | |
【换取手持示波器】RGB屏幕移植ARM-2D库被打赏35分 | |
【分享开发笔记,赚取电动螺丝刀】分享一下如何解决瑞萨RA2E1使用printf编译报错问题被打赏27分 | |
rtthread硬件加密-5hash加密分析被打赏10分 | |
【换取手持示波器】Mongoose 零代码创建网页仪表盘被打赏33分 | |
【分享开发笔记,赚取电动螺丝刀】基于.Net6.0 WPF简单做一个MQTT收发小工具被打赏24分 |