【Silicon Labs 开发套件评测】– 牛刀小试
本帖最后由 懒猫爱飞 于 2021-8-8 00:27 编辑<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线"> 说实在话,silicon的MCU以前没有接触过,所以前期准备工作做的有点多,好吧,今天开始进入正题,开始测试工程。简单的看了一下,</span></span></span><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">新建一个空工程,只做一个闪灯实验,主要目的就是学会用编译器,简单的知道怎么开发这款MCU, 关开Simplicity Studio V5的使用说明,官方的链接如下所示,有兴趣的同学可以去看看:</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线"><a href="https://docs.silabs.com/simplicity-studio-5-users-guide/5.2.0/ss-5-users-guide-about-the-launcher/">https://docs.silabs.com/simplicity-studio-5-users-guide/5.2.0/ss-5-users-guide-about-the-launcher/</a></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">好了,下面开始记录一下学习的过程:</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">先插入开发板,IDE会自动识别开发板类型,这个功能蛮好,建议其它厂家学习一下,点出start开始建立新工程</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">这个页面里机的各个标签都有不同的工程,可以浏览一下,对于学习这个MCU还是很有帮助的</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">因为我用的是C,就选择C空工程吧,当然里面也有一些Demo例程,前面已经说过了,这里主要是学习怎么使用simplicity studio及如果建议一个MCU工程,所以我就没有选择例程,而且从最简单的LED闪灯开始。</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">这个页面都是通用的设置,关于“with project files”的选项如果是自己开发,工程文件可以选择链接,如果方便打包就选择最后一个。</span></span></span> </p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">创建过程很快,稍等立就。</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> <span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">建立好的空工程是这样的,里面已设置好了一些文件,gecko_sdk_3.2.1是一些库文件,这个在后面的篇章中会研究,这里就不详细展开了。</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">查看原理图可知,LED口在PA4,所以设置PA4为普通 IO口为控制LED</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> <span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">配置完成,会自动保存,然后,找开app.c做一个简单的LED闪灯小程序。</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">因为程序比较简单,就直接在app_init()中写LED端口初始化函数了, 如果是正式的工程,建议不要这样搞,一定要分层次,分模块</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> <span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">写一个简单的LED控制函数,一切准备绪。</span></span></span> </p>
<p style="text-indent:21.0pt; text-align:justify"> <span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">简单测试的小程序,就这样简单粗暴。本来想写个定时器及串口的,看看文档,东西比较多,就后面再研究吧。关于这个sl_udelay_wait()在下面这个位置有定义:</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">好了,写完函数,编译,是的就是锤子那个图标,也可以用快捷键Ctrl+B</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> </p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">编译完成,没啥毛病,然后就下载到板子试一下呗</span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify">上图看看效果:</p>
<p style="text-indent:21.0pt; text-align:justify"></p>
<p style="text-indent:21.0pt; text-align:justify"> </p>
<p style="text-indent:21.0pt; text-align:justify">工程文件如下:</p>
<p style="text-indent:21.0pt; text-align:justify"></p>
<p style="text-indent:21.0pt; text-align:justify"><br />
<span style="font-size:10.5pt"><span style="150%"><span style="font-family:等线">最后,说一下Simplicity studio的快捷键, Simplicity Studio的快捷键比较多,下面列举几个实用的快捷键:</span></span></span> </p>
<table class="MsoTableGrid" style="border-collapse:collapse; border:none">
<tbody>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; height:27px; border-top:2px solid black; border-right:2px solid black; border-left:2px solid black">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线"><b>序号</b></span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; height:27px; border-top:2px solid black; border-right:2px solid black; border-left:none">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线"><b>快捷键</b></span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; height:27px; border-top:2px solid black; border-right:2px solid black; border-left:none">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线"><b>功能说明</b></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">1</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">F2</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">鼠标点击到函数,会出现函数预览,F2是强制显示预览</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">2</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">F3</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">鼠标点击到函数,跳转的函数的定义处</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">3</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Ctrl + H</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">全局查找 </span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">4</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Alt + Enter</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">打开工程属性</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">5</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Alt + Left</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">返回上一跳转处,配合F3使用</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">6</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Ctrl + B</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">Build工程</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">7</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Ctrl + 7</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">注释或取消注释</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">8</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Ctrl + Tab</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">鼠标定位到包含的头文件处,打开头文件</span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:56px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">9</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:104px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="font-family:等线">Ctrl + Q</span></span></p>
</td>
<td style="border-bottom:2px solid black; width:393px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">返回上一编辑处</span></span></p>
</td>
</tr>
</tbody>
</table>
<p> </p>
<p>好了,今天先记录这些内容吧,下篇继续记录学习之路上的点点滴滴^_^</p>
<p style="text-align: center;"><span style="font-size:20px;"><strong>每天进步一点点,开心多一点<img height="48" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/wanwan58.gif" width="54" /></strong></span></p>
<p>看来第一步挺顺利,楼主加油</p>
页:
[1]