版本协议

GPL 3.0

标签
专业版
#第七届立创电赛#实用USB功率计、彩灯

创建时间:2年前

7917 3

描述

<div class="document"> <h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">* 1、项目功能介绍</h3> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">使用国民技术ARM Cortex-M4内核芯片N32G430C8L7,加上德州仪器INA199A1实现的USB电压、电流、功率计,扩展了简单RGB彩灯。</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">*2、项目属性</h3> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">嘉立创2022暑期训练营</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">* 3、开源协议</h3> <hr class="horizontal-splitline normal-bold-2"><p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">GPL 3.0</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">*4、硬件部分</h3> <hr class="horizontal-splitline normal-bold-2"></div> <div class="document"> </div> <div class="document">使用立创EDA专业版画图。扩展的RGB彩灯,每种颜色的LED共用一个IO配合三极管进行驱动。</div> <div class="document"><img src="//image.lceda.cn/pullimage/IwYERQj7FOL4p3UuMod3bvbG0ldT6JPzaTCy2R9Y.png" alt="IwYERQj7FOL4p3UuMod3bvbG0ldT6JPzaTCy2R9Y.png"></div> <div class="document"> </div> <div class="document"><br><h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">*5、软件部分</h3> <hr class="horizontal-splitline normal-bold-2"><p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">编译环境:</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">Keil uVision V5.25</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">烧录工具:</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">Pwlink2</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">参考代码:</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">【1】训练营示例工程《N32G430C8L7-USBMeter》</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">【2】国民技术官方示例:n32g430_EVAL\examples\GPIO\Led_Blink</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">【3】国民技术官方示例:n32g430_EVAL\examples\TIM\TIM_Demo\TIM_Basic</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">扩展的LED彩灯代码主要如下:</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">void led_rgb(uint32_t x) //点灯程序<br>{<br>    switch(x)<br>    {<br>        case 1:<br>        LED1_ON; LED2_OFF; LED3_OFF;  //红<br>        break;<br>        <br>        case 2:<br>        LED2_ON; LED1_OFF; LED3_OFF;  //绿<br>        break;<br>        <br>        case 3:<br>        LED3_ON; LED1_OFF; LED2_OFF;  //蓝<br>        break;<br>        <br>        case 4:<br>        LED1_ON; LED3_ON; LED2_OFF;   //蓝红 <br>        break;<br>        <br>        case 5:<br>        LED1_ON; LED2_ON; LED3_OFF;   //红绿<br>        break;<br>        <br>        case 6:<br>        LED2_ON; LED3_ON; LED1_OFF;   //绿蓝 <br>        break;<br>        <br>        case 7:<br>        LED1_ON; LED2_ON; LED3_ON;   //红绿蓝 <br>        break;<br>        <br>        default:<br>        break;<br>    }<br>}</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">void TIM6_IRQHandler(void) //定时器中断服务函数<br>{<br>    static uint32_t tt = 1;<br>    if (TIM_Interrupt_Status_Get(TIM6, TIM_INT_UPDATE) != RESET)<br>    {<br>      TIM_Interrupt_Status_Clear(TIM6, TIM_INT_UPDATE);<br>            <br>            cnt++;     //cnt是全局变量<br>            if(cnt>50) //设置定时<br>      {<br>             cnt = 0; <br>                <br>             tt++;<br>             if(tt>7) tt = 1;<br>                <br>             led_rgb(tt);//tt范围1到7,对应7种颜色<br>            }<br>    }<br>}</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">-------------------------------------------------------------------------------------------------------------------</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">最初打算做PWM渐变灯的,但是由于MCU的IO口没有独立引出,并且MCU在屏幕下方,给调试带来了很大不便。折腾了很久没有进展,最后改为相对更简单的RGB灯。</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">实物完成后,经过多次测试,用手机充电器供电,</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">功率计OLED显示的电压值比万用表测得的值高0.2V至0.3V,</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">           OLED显示的电流值与万用表200mA档测得的值基本一致。第3张照片,功率计电流0.11A,万用表测得113mA。</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">USB功率计总体精度满足个人使用需求。</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">参加这次训练营,得到了一个非常实用的测量工具。这次训练营真的值!感谢嘉立创&国民技术!</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">-------------------------------------------------------------------------------------------------------------------</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">实物照片如下:</p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"><img src="//image.lceda.cn/pullimage/Hj7nxY1NqhSo46tsYnolfig8PnuKUUwGUYH54hxF.jpeg" alt="" width="653" height="490"><img src="//image.lceda.cn/pullimage/pX0OYXjkRCkFJTQbIOYTQxhlXzbCi1IgZEUa6ejj.jpeg" alt="" width="653" height="490"><img src="//image.lceda.cn/pullimage/5aLzDcHxjxoNORfSEDMaVa6dLvliIZWhk4xPy8LW.jpeg" alt="" width="653" height="870"><img src="//image.lceda.cn/pullimage/2Bhodj8MNJ4M0XIeiGCGbqYdXUmUt5KOGymgZCdo.jpeg" alt="" width="653" height="490"><img src="//image.lceda.cn/pullimage/rV8UcKKkYIgFOpTmJ2dGiNTWks6MZFRSeK6EqMXb.jpeg" alt="" width="653" height="490"><img src="//image.lceda.cn/pullimage/fbOtqGYMDpqlZ3svgL6OdFPaikSVxf540AeCRzOk.jpeg" alt="" width="653" height="870"></p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-left-indent-1.6em" style="line-height:1.8;"> </p> <h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">6、BOM清单</h3> <hr class="horizontal-splitline normal-bold-2"><h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">*7、大赛LOGO验证</h3> <hr class="horizontal-splitline normal-bold-2"><p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">* 8、演示您的项目并录制成视频上传</h3> <hr class="horizontal-splitline normal-bold-2"><p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;">B站链接:<a href="https://www.bilibili.com/video/BV1AS4y1s72h?spm_id_from=333.337.search-card.all.click&vd_source=52d9aa1d12b4e4017271eb13df97e091" target="_blank">https://www.bilibili.com/video/BV1AS4y1s72h?spm_id_from=333.337.search-card.all.click&vd_source=52d9aa1d12b4e4017271eb13df97e091</a></p> <p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height:1.8;"> </p> </div>

文档

BOM

暂无

附件

附件名 下载
嘉立创2022暑期训练营【国民技术USB功率计&彩灯2合1】演示视频.mp4

成员

评论(3)

  • 表情
    emoji
    小嘉工作篇
    小嘉日常篇
  • 图片
成功
工程所有者当前已关闭评论
aitansuozhe 回复
<p>官方例子是用INA199B1,你用了INA199A1,需要修改官方的程序吗?还是说官方程序可以正常运行</p>
nice663 回复
<p>不用修改官方程序。训练营硬件设计直播时,莫工解释过,用B1或A1都可以</p>
aitansuozhe 回复
<p>好的,这样就懂了,感谢感谢</p>
goToTop
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow