这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界» 论坛首页» 活动中心» 板卡试用» 【EFM8BB52单片机】便携桌面天气预报器(串口调试

共5条 1/1 1 跳转至

【EFM8BB52单片机】便携桌面天气预报器(串口调试

专家
2021-12-16 22:56:00 被打赏50分(兑奖) 打赏

试用项目:家庭天气预报设备

很高兴在活动截止时间得到试用名额。由于时间紧张,就做个便携天气预报器来做个衬托。

功能框图:

11111.png

功能介绍:

1、单片机通过串口连接4G通信模组,获取天气情况

2、单片机解析天气信息,在OLED上显示

3、主要用到单片机串口和IIC,如果时间允许,优化该部分程序

4、未知功能

为了和坛友互动,这部分大家可以给个建议,还需要什么功能呢?




关键词: EFM8BB52 单片机 天气预报

专家
2021-12-17 09:38:19 被打赏10分(兑奖) 打赏
2楼

开箱

伴随着快递的敲门声,这个NB的51单片机来到我手中。

白柴的顺丰快递包装真的很给力,很大的盒子中包含防撞汽包

1.jpg

拆开防静电袋子之后,会发现小巧的单片机板子

难怪从海外万里昭昭来到中国,防静电的袋子也很严实,放置出现静电的捣乱。

1639667050527080.jpg

来个板子的近图,做工很精细,只是焊盘不是镀金,有点不符silicon的大厂风范,难道是pcb也涨价导致的?

开发板一般都自带程序,直接上电看看

5.jpg

黄灯常亮,说明片子没有问题。

那么下一步,我们来个点灯?


专家
2021-12-20 15:22:18 被打赏50分(兑奖) 打赏
3楼

点灯继续:

在官方例子上进行修改,添加管脚定义,添加一个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  #include  #include  //----------------------------------------------------------------------------- // 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

专家
2021-12-20 15:48:34 打赏
4楼

灯跑起来了,那么其他的外设有没有对应的资源呢?

别慌,都在这里

图片.png


专家
2021-12-20 19:36:31 打赏
5楼

串口调试起来。

从datesheet上看接口,有两路串口

image.png

image.png

那么是哪个端口呢?

首先选定串口接口,

image.png

从板子上看0.4 0.5 和2.2 2.3为两组串口接口。

本次我们使用0.4和0.5来进行串口通信实验。


共5条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册]