描述
<div class="document">
<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/m1BsBa4QE40JHiBUUDKw0GrD2AOlUAEiGC3Hxjtg.jpeg" alt="" width="571" height="429"></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/sNZA9zH4EX7hqsTygLQycXFSHKqiGEK8X5ilONun.jpeg" alt="" width="572" height="429">注:* 为必填项</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;"><strong><span style="color: #0093e6;">请在报名阶段填写 ↓</span></strong></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;">* 1、项目功能介绍</h3>
<hr class="horizontal-splitline normal-bold-2">
<p><strong><span style="font-family: 宋体;">1、</span><span style="font-family: 宋体;">使用</span><span style="font-family: 宋体;">集成电路</span><span style="font-family: 宋体;">运放,</span><span style="font-family: 宋体;">电阻电容等常规器件</span><span style="font-family: 宋体;">设计制作</span><span style="font-family: 宋体;">一个简易信号源,能够输出</span><span style="font-family: 宋体;">方波、三角波、正弦波三</span><span style="font-family: 宋体;">种波形。</span></strong></p>
<p> </p>
<p><strong><span style="font-family: 宋体;">2、方波的频率和占空比可以连续调节,三角波、正弦波的频率和幅值可以连续调节。</span></strong></p>
<p> </p>
<p><strong><span style="font-family: 宋体;">3、方波频率:40 - 200 HZ 方波占空比: 0 -100% 三角波、正弦波幅值:0 - 3.2 V</span></strong></p>
<p> </p>
<p><strong><span style="font-family: 宋体;">3、用STM32单片机测量信号源的</span><span style="font-family: 宋体;">峰峰值和频率等并用OLED显示出来。</span></strong></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>
<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;">项目首次公开且原创</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>
<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;">GPL3.0开源协议</p>
<p 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;"><strong><span style="color: #0093e6;">请在竞赛阶段填写 ↓</span></strong></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">
<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><strong>1.<span style="font-family: 宋体;">经滞回比较器和积分器构成方波三角波产生电路。</span></strong></p>
<p> <span style="font-family: 宋体;">把滞回比较器和积分比较器首尾相接形成正反馈闭环系统,就构成三角波发 生器和方波发生器。比较器输出的方波经积分器可得到三角波、三角波又触发比较器自动翻转形成方波,这样即可构成三角波</span><span style="font-family: Calibri;">-</span><span style="font-family: 宋体;">方波发生器。</span></p>
<p><strong>2.<span style="font-family: 宋体;">通过低通滤波把三角波转换成正弦波信号。</span></strong></p>
<p> <span style="font-family: 宋体;">经低</span><span style="font-family: 宋体;">通滤波把三角波转换成正弦波。</span></p>
<h2><strong><span style="font-family: 宋体;">方波</span><span style="font-family: 宋体;">-三角波发生电路原理</span></strong></h2>
<p> <span style="font-family: 宋体;">电路由集成运放与</span><span style="font-family: Calibri;">R4</span><span style="font-family: 宋体;">、</span><span style="font-family: Calibri;">R6</span><span style="font-family: 宋体;">及一个滞回比较器和一个充放电回路组成。 </span><span style="font-family: Calibri;">R1 </span><span style="font-family: 宋体;">的作用是钳位,将滞回比较器的输出电压限制在稳定电压值。滞回比较器的输出只有两种可能状态:高电平或低电平。滞回比较器的两种不同的输出电平使</span><span style="font-family: Calibri;">RC</span><span style="font-family: 宋体;">电路进行充电或放电,于是电容上的电压将升高或降低,而电容上的电压又作为滞回比较器的输入电压,控制其输出端状态发生跳变,从而使 </span><span style="font-family: Calibri;">RC </span><span style="font-family: 宋体;">电路由充电过程变为放电过程或相反。如此循环往复,周而复始,最后在滞回比较器的输出端即可得到一个高低电平周期性交替的矩形波即方波 。</span></p>
<p> <span style="font-family: 宋体;">滞回比较器输出的方波经积分器可得到三角波、三角波又触发比较器自动翻转形成方波,便构成了方波</span><span style="font-family: Calibri;">-</span><span style="font-family: 宋体;">三角波发生器。</span></p>
<h2><strong><span style="font-family: 宋体;">正弦波发生电路原理</span></strong></h2>
<p><span style="font-family: 宋体;">选择低通滤波电路,在多次仿真实验之后,决定选择三阶</span>RC<span style="font-family: 宋体;">压控电压源有源低通滤波器,且电阻的值应尽量减小,以减少直流电压的损耗。采用三阶低通滤波的正弦波发生电路图。</span></p>
<h2><strong><span style="font-family: 宋体;">三角波、正弦波</span> <span style="font-family: 宋体;">波形放大</span></strong></h2>
<p><span style="font-family: 宋体;">由于滞回比较器和多阶滤波产生的波形幅值较小,这里采用了运放的放大功能。(同相比例运算放大电路)</span></p>
<p> </p>
<p> </p>
<p><strong><span style="font-family: 宋体;">原理图如下: </span></strong></p>
<p> </p>
<p><strong><img src="//image.lceda.cn/pullimage/ZBTWaJTL3esPWZ6WRkdN2AiequNhed3GcAQTUTj9.png"></strong></p>
<p> </p>
<p><strong><span style="font-family: 宋体;">波形结果如下:</span></strong></p>
<p> </p>
<p><strong><img src="//image.lceda.cn/pullimage/uzobX5rGcM4sllUvKIewBuppgDdYrLCjq4rxM0nf.png"></strong></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>
<p><strong>DEA<span style="font-family: 宋体;">原理图和</span><span style="font-family: Calibri;">PCB </span><span style="font-family: 宋体;">如下:</span></strong></p>
<p> </p>
<p><strong><img src="//image.lceda.cn/pullimage/y11iQJbcGj1fDJWe60BPOOPuV4ohKM7Afykilg4T.png"></strong></p>
<p><strong><img src="//image.lceda.cn/pullimage/pfe4eq12ot9Fp5RZfC9ki17In5myZIzM5kQGWwlT.png"></strong></p>
<p><strong><img src="//image.lceda.cn/pullimage/XUr5UUu0TFCATvV3IPcERJ2bIuzEdXvHDtN0gO1T.png"></strong></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;">*5、软件部分</h3>
<hr class="horizontal-splitline normal-bold-2">
<p><span style="font-family: 宋体;">在软件开发上我们采用</span><span style="font-family: 宋体;">Keil5作为开发编程工具,考虑到在频率测量过程中有比较多的数学运算,所以在编程工具上我们采用了C语言,这样开发过程就变的更加轻松了。</span></p>
<p><span style="font-family: 宋体;"> 我们使用了STM32F103c8t6的PA0引脚去测量频率,使用PA1引脚去测峰峰值。OLED的SCL引脚连接32的PB9,SDA引脚连接32的PB8。</span></p>
<p><span style="font-family: 宋体;"> 部分代码程序如下:</span></p>
<p> </p>
<p><strong><span style="font-family: 宋体;">测频率程序如下:</span></strong></p>
<p><span style="font-family: 宋体;">u32</span> <span style="font-family: 宋体;">TIM2CH1_CAPTURE_VAL;</span> <span style="font-family: 宋体;">//输入捕获值</span></p>
<p><span style="font-family: 宋体;">u32</span> <span style="font-family: 宋体;">CNT=0;</span> <span style="font-family: 宋体;">//输入捕获值</span></p>
<p><span style="font-family: 宋体;">u32</span> <span style="font-family: 宋体;">flag=0;</span> <span style="font-family: 宋体;">//定时长度标识符</span></p>
<p><span style="font-family: 宋体;">u32</span> <span style="font-family: 宋体;">overflow=0; //溢出次数标识符</span></p>
<p><span style="font-family: 宋体;">u32</span> <span style="font-family: 宋体;">cnt;</span></p>
<p><span style="font-family: 宋体;">int a=0;</span></p>
<p><span style="font-family: 宋体;">int b=0;</span></p>
<p><span style="font-family: 宋体;">int c=0;</span></p>
<p><span style="font-family: 宋体;">int d=0;</span></p>
<p><span style="font-family: 宋体;">void TIM2_Cap_Init(void) //配置 TIM2_CH1_ETR 为外部脉冲计数</span></p>
<p><span style="font-family: 宋体;">{ </span></p>
<p> <span style="font-family: 宋体;">GPIO_InitTypeDef GPIO_InitStructure;</span></p>
<p> <span style="font-family: 宋体;">TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;</span></p>
<p> <span style="font-family: 宋体;">RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); //使能TIM2时钟</span></p>
<p> <span style="font-family: 宋体;">RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); //使能GPIOA时钟</span></p>
<p> <span style="font-family: 宋体;">GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; //PA0 清除之前设置 </span></p>
<p> <span style="font-family: 宋体;">GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; //PA0 输入 </span></p>
<p> <span style="font-family: 宋体;">GPIO_Init(GPIOA, &GPIO_InitStructure);</span></p>
<p> <span style="font-family: 宋体;">GPIO_SetBits(GPIOA,GPIO_Pin_0); //PA0 下拉</span></p>
<p> <span style="font-family: 宋体;">//初始化定时器2 TIM2 </span></p>
<p> <span style="font-family: 宋体;">TIM_TimeBaseStructure.TIM_Period = 0xFFFF; //设定计数器自动重装值 </span></p>
<p> <span style="font-family: 宋体;">TIM_TimeBaseStructure.TIM_Prescaler =0; //预分频器 </span></p>
<p> <span style="font-family: 宋体;">TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //设置时钟分割:TDTS = Tck_tim</span></p>
<p><span style="font-family: 宋体;">TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; </span></p>
<p><span style="font-family: 宋体;">//TIM向上计数模式</span></p>
<p><span style="font-family: 宋体;">TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);</span></p>
<p><span style="font-family: 宋体;">//根据TIM_TimeBaseInitStruct中指定的参数初始化TIMx的时间基数单位</span></p>
<p><span style="font-family: 宋体;">TIM_ITRxExternalClockConfig(TIM2,TIM_TS_ETRF);</span></p>
<p><span style="font-family: 宋体;">//配置外部触发,否则不会计数</span></p>
<p><span style="font-family: 宋体;">TIM_ETRClockMode2Config(TIM2,TIM_ExtTRGPSC_OFF,</span></p>
<p><span style="font-family: 宋体;">TIM_ExtTRGPolarity_NonInverted, 0);</span></p>
<p> <span style="font-family: 宋体;">TIM_SetCounter(TIM2, 0); </span></p>
<p> <span style="font-family: 宋体;">TIM_Cmd(TIM2,ENABLE ); //使能定时器</span></p>
<p><span style="font-family: 宋体;">}</span></p>
<p> </p>
<p><strong><span style="font-family: 宋体;">测峰峰值程序如下:</span></strong></p>
<p><span style="font-family: 宋体;">void Adc_Init(void)</span></p>
<p><span style="font-family: 宋体;">{</span></p>
<p><span style="font-family: 宋体;">ADC_InitTypeDef ADC_InitStructure; </span></p>
<p><span style="font-family: 宋体;">GPIO_InitTypeDef GPIO_InitStructure;</span></p>
<p><span style="font-family: 宋体;">// ADC_StructInit(&ADC_InitStructure);</span></p>
<p><span style="font-family: 宋体;">RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |RCC_APB2Periph_ADC1, ENABLE );</span> <span style="font-family: 宋体;">//使能ADC1通道时钟</span></p>
<p><span style="font-family: 宋体;">RCC_ADCCLKConfig(RCC_PCLK2_Div6); </span></p>
<p><span style="font-family: 宋体;">//设置ADC分频因子6 72M/6=12,ADC最大时间不能超过14M</span></p>
<p><span style="font-family: 宋体;">//PA1 作为模拟通道输入引脚 </span></p>
<p><span style="font-family: 宋体;">GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;</span></p>
<p><span style="font-family: 宋体;">GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;</span> <span style="font-family: 宋体;">//模拟输入引脚</span></p>
<p><span style="font-family: 宋体;">GPIO_Init(GPIOA, &GPIO_InitStructure);</span></p>
<p><span style="font-family: 宋体;">ADC_DeInit(ADC1); //复位ADC1 </span></p>
<p><span style="font-family: 宋体;">ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;</span></p>
<p><span style="font-family: 宋体;">//ADC工作模式:ADC1和ADC2工作在独立模式</span></p>
<p><span style="font-family: 宋体;">ADC_InitStructure.ADC_ScanConvMode = DISABLE;</span> <span style="font-family: 宋体;">//模数转换工作在单通道模式</span></p>
<p><span style="font-family: 宋体;">ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;</span></p>
<p><span style="font-family: 宋体;">//模数转换工作在单次转换模式</span></p>
<p><span style="font-family: 宋体;">ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;</span></p>
<p><span style="font-family: 宋体;">//转换由软件而不是外部触发启动</span></p>
<p><span style="font-family: 宋体;">ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;</span> <span style="font-family: 宋体;">//ADC数据右对齐</span></p>
<p><span style="font-family: 宋体;">ADC_InitStructure.ADC_NbrOfChannel = 1;</span> <span style="font-family: 宋体;">//顺序进行规则转换的ADC通道的数目</span></p>
<p><span style="font-family: 宋体;">ADC_DeInit(ADC1);</span></p>
<p><span style="font-family: 宋体;">ADC_Init(ADC1, &ADC_InitStructure);</span> <span style="font-family: 宋体;">//根据ADC_InitStruct中指定的参数初始化外设ADCx的寄存器 </span></p>
<p><span style="font-family: 宋体;">ADC_Cmd(ADC1, ENABLE);</span> <span style="font-family: 宋体;">//使能指定的ADC1</span></p>
<p><span style="font-family: 宋体;">ADC_ResetCalibration(ADC1);</span> <span style="font-family: 宋体;">//使能复位校准 </span></p>
<p><span style="font-family: 宋体;">while(ADC_GetResetCalibrationStatus(ADC1));</span> <span style="font-family: 宋体;">//等待复位校准结束</span></p>
<p><span style="font-family: 宋体;">ADC_StartCalibration(ADC1);</span> <span style="font-family: 宋体;">//开启AD校准</span></p>
<p><span style="font-family: 宋体;">while(ADC_GetCalibrationStatus(ADC1));</span> <span style="font-family: 宋体;">//等待校准结束</span></p>
<p><span style="font-family: 宋体;">ADC_SoftwareStartConvCmd(ADC1, ENABLE);</span> <span style="font-family: 宋体;">//使能指定的ADC1的软件转换启动功能</span></p>
<p><span style="font-family: 宋体;">}</span></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>
<p> </p>
<p> </p>
<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;"><img src="//image.lceda.cn/pullimage/PibE75XqiRRN6VEjYNAua7uzSBzprtFp4bCrBnkD.png" alt="" width="1002" height="605"></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>
<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 style="line-height: 1.8;"> </p>
<p style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/AbmCCLVF6bM5tQQxczReKft1V64A2QWLnaYBGRD5.jpeg" alt="" width="376" height="282"></p>
<p style="line-height: 1.8;"> </p>
<p 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;"><span style="color: #95a5a6; font-size: 14px;">请上传包含大赛logo的项目图片,logo以丝印形式印刷在PCB上面。</span></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;"><span style="color: #95a5a6; font-size: 14px;">点击zip下载大赛logo标识! <span style="text-decoration: underline;"><a href="https://image.lceda.cn/easyedaResource/images/%E7%AB%8B%E5%88%9B%E7%94%B5%E8%B5%9B%E6%A0%87%E8%AF%86.rar" target="_blank">(大赛标识).zip</a></span></span></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;">* 8、演示您的项目并录制成视频上传</h3>
<hr class="horizontal-splitline normal-bold-2">
<p 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;"><span style="color: #95a5a6; font-size: 14px;">视频要求:请横屏拍摄,分辨率不低于1280×720,格式Mp4/Mov,单个视频大小限100M内;</span></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;"><span style="color: #95a5a6; font-size: 14px;">视频标题:立创电赛:{项目名称}-{视频模块名称};如立创电赛:《自动驾驶》-团队介绍。</span></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;"><span style="font-size: 14px;">更多详情:<a href="/posts/15a52db9fd7d40c492eb505280278e45" target="_blank">https://diy.szlcsc.com/posts/15a52db9fd7d40c492eb505280278e45</a></span></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>
评论(4)