试用项目:家庭天气预报设备
很高兴在活动截止时间得到试用名额。由于时间紧张,就做个便携天气预报器来做个衬托。
功能框图:
功能介绍:
1、单片机通过串口连接4G通信模组,获取天气情况
2、单片机解析天气信息,在OLED上显示
3、主要用到单片机串口和IIC,如果时间允许,优化该部分程序
4、未知功能
为了和坛友互动,这部分大家可以给个建议,还需要什么功能呢?
开箱
伴随着快递的敲门声,这个NB的51单片机来到我手中。
白柴的顺丰快递包装真的很给力,很大的盒子中包含防撞汽包
拆开防静电袋子之后,会发现小巧的单片机板子
难怪从海外万里昭昭来到中国,防静电的袋子也很严实,放置出现静电的捣乱。
来个板子的近图,做工很精细,只是焊盘不是镀金,有点不符silicon的大厂风范,难道是pcb也涨价导致的?
开发板一般都自带程序,直接上电看看
黄灯常亮,说明片子没有问题。
那么下一步,我们来个点灯?
点灯继续:
在官方例子上进行修改,添加管脚定义,添加一个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
串口调试起来。
从datesheet上看接口,有两路串口
那么是哪个端口呢?
首先选定串口接口,
从板子上看0.4 0.5 和2.2 2.3为两组串口接口。
本次我们使用0.4和0.5来进行串口通信实验。
有奖活动 | |
---|---|
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
【有奖活动】智能可穿戴设备AR/VR如何引领科技新潮流! | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
【有奖活动】震撼来袭!这场直播将直击工程师的心灵! |