你这么一说,又仔细看了一眼开发板。
真的有点紫铜的颜色啊
点灯继续:
在官方例子上进行修改,添加管脚定义,添加一个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 | 有奖活动 | |
|---|---|
| 硬核工程师专属补给计划——填盲盒 | |
| “我踩过的那些坑”主题活动——第002期 | |
| 【EEPW电子工程师创研计划】技术变现通道已开启~ | |
| 发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
| 【EEPW在线】E起听工程师的声音! | |
| 高校联络员开始招募啦!有惊喜!! | |
| 【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
| 送您一块开发板,2025年“我要开发板活动”又开始了! | |
我要赚赏金打赏帖 |
|
|---|---|
| Chaos-nano:专为低资源单片机设计的轻量级协作式异步操作系统(ATMEGA328P轻量级操作系统)—— 详细介绍被打赏¥16元 | |
| FPGA配置被打赏¥10元 | |
| Chaos-nano协作式异步操作系统:赋能MicrochipAVR8位单片机的革新之路被打赏¥15元 | |
| 基于esp32开发时串口工具的注意点被打赏¥24元 | |
| 基于FireBeetle2ESP32-C5开发板的舵机控制被打赏¥20元 | |
| 【分享开发笔记,赚取电动螺丝刀】MAX78000开发板制作的电子相册被打赏¥32元 | |
| 基于FireBeetle2ESP32-C5开发板的超声波测距及显示被打赏¥21元 | |
| FireBeetle2ESP32-C5上RTC电子时钟的实现被打赏¥25元 | |
| 【分享开发笔记,赚取电动螺丝刀】MAX78000开发板读取SD卡被打赏¥23元 | |
| 【S32K3XX】Standby RAM 重启后数据异常问题调查被打赏¥38元 | |