你这么一说,又仔细看了一眼开发板。
真的有点紫铜的颜色啊
点灯继续:
在官方例子上进行修改,添加管脚定义,添加一个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
打赏帖 | |
---|---|
【STM32F769】AI之与本地deepseek对接被打赏50分 | |
Buck电路工作在CCM模式下电感电流的计算公式是什么?被打赏5分 | |
buck电路工作原理被打赏5分 | |
基于MSPM0L1306的MODBUS-RTU协议通讯实验被打赏100分 | |
我想要一部加热台+多合一调试工具被打赏18分 | |
每周了解几个硬件知识+485硬件知识分享被打赏10分 | |
【换取手持数字示波器】树莓派PICO调试器官方固件本地化部署实践被打赏24分 | |
【换取手持数字示波器】分享一个KEIL无法识别CMSIS-DAP调试器的解决办法被打赏20分 | |
【换取手持数字示波器】分享一个自制的ArduinoNano扩展板底板被打赏23分 | |
【换取手持示波器】树莓派PICOW网页烟花被打赏18分 |