找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2655|回复: 0
收起左侧

STM32F4读取波形程序(使用管脚复用功能实现)

[复制链接]
ID:281986 发表于 2018-2-3 16:59 | 显示全部楼层 |阅读模式
该函数基于STM32F4,使用管脚复用功能实现读取波形。亲测可用

单片机源程序如下:
  1. #include "stm32f4xx.h"
  2. #include "led.h"
  3. #include "key.h"
  4. #include "usart.h"
  5. #include "string.h"
  6. #include "exti.h"
  7. #include "delay.h"
  8. #include "at24c02.h"
  9. #include "w25q64.h"
  10. #include "lcd.h"
  11. #include "pwm.h"

  12. int main()
  13. {
  14.         u8 key;
  15.         lcddev.type=0x9486; //lcd驱动型号
  16.         LED_Init(); //LED初始化
  17.         KEY_Init(); //按键初始化
  18.         SCB->AIRCR =0X05FA0500; //设置为组2
  19.         usart1_init(9600);//串口初始化,波特率为9600
  20.         //exti_init();  //外部中断初始化
  21.         delay_init(); //延时初始化
  22.         at24c02_init();       
  23.         W25Q64_Init();
  24.         lcd_init();
  25.         lcd_clear(WHITE);
  26.         Tim12_Ch2_Init(84,2000);
  27.         while(1)
  28.         {
  29.                 key=key_scanf(0);
  30.                 if(key==KEY1)
  31.                 {
  32.                         if(TIM12->CCR2<2000)
  33.                                 TIM12->CCR2 += 200;
  34.                 }
  35.                 else if(key==KEY2)
  36.                 {
  37.                         if(TIM12->CCR2>200)
  38.                                 TIM12->CCR2 -= 200;
  39.                 }
  40.         }
  41. }

  42. //练习 1.写一个呼吸灯(PWM实现) PF6  PF9
  43. // 扩展2.通过触摸屏来改变LCD的背光,并且能够实现保存背光的亮度.在LCD上显示亮度的百分比。
复制代码

所有资料51hei提供下载:
stm32f4_project-读取波形.rar (391.88 KB, 下载次数: 17)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表