打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
1

#include "stm32f10x.h"
#include "usart.h"
#include "stm32f10x_it.h"
#include "adc.h"
#include "dma.h"
#include <stdlib.h>


u16 adcx,temp;
u8  table[5];
extern u16 cmar[16];


/*发送字符串*/

void USART1_Puts(unsigned char *str)
{
    while(*str)
    {
        USART_SendData(USART1, *str++);
       
        while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
    }
}


/*延时函数*/

void Delay(__IO u32 nCount)
{
 for(; nCount != 0; nCount--);
}

/*设置中断组*/
void NVIC_Configuration(void)
{

    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级

}


int main(void)
{

  SystemInit(); 
  NVIC_Configuration();
  USART1_Config();
  Adc_Init();
  dma_config(DMA1_Channel4);
  while(1)
  {
      Delay(1000000);
  adcx=DigitFilter(cmar,16);
  dma_start();
  adcx=(1.42 - adcx*3.3/4096)*1000/4.35 + 25;
  temp=adcx*330/4096;                      
  adcx = temp;
  table[0]=adcx / 100 + 0x30;
  table[1]='.';
  table[2]=adcx % 100/10 + 0x30;
  table[3]= adcx %10 + 0x30;
  table[4]='V';
  Delay(100000);
  USART1_Puts(table);
    Delay(1000000);

}
}

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
STM32F1系列之常用外设说明
STM32学习笔记之ADC
STM32串口通讯 UART
九九的STM32笔记(四)DMA、USART的演示 (www.ourdev.cn)
【原创】STM32F103的USART2配置代码, DMA方式发送!
stm32 DMA数据搬运 [操作寄存器+库函数]-Changing's Blog
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服