激光 pm2.5传感器 攀藤科技 stm32 调试通过

///
//作者:zhl
//时间:2015,4,2
//程序:夏普二代PM传感器串口读取
//声明:未经应许,不得他用
///
#include "stm32f10x_lib.h"
#include "stdio.h"
#include "delay.h"


#define u8 unsigned char
#define u16 unsigned int
#define u32 unsigned long
u8 Uart1_Rx;
u8 Uart1_Tx;
u8 Uart1_Sta=0;
u8 Uart1_Buffer[];
u8 Uart1_Len;
u8 tx1;




GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
USART_InitTypeDef USART_InitStructure;


void USART1_SendByte(u8 ch);


void RCC_Config(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); // 时钟参数初始化设置
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO,ENABLE );
}


void GPIO_Configuration(void)
{
/* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; // 选中管脚9
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; // 复用推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // 最高输出速率50MHz
GPIO_Init(GPIOA, &GPIO_InitStructure); // 选择A端口

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;  //选中管脚10
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;  //浮空输入
GPIO_Init(GPIO
  • 7
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值