stm32和LABVIEW串口通讯最基础的问题
时间:10-02
整理:3721RD
点击:
各位大神,小弟最近刚编了一个LABVIEW用串口向下位机发送数据的程序,我想把数据发送到STM32上,进而控制开发板的LED灯,需要注意些什么吗,我就直接用串口2和电脑相连,接收LABVIEW发送的数据,怎么接收不成功啊。跪求
#include "stm32f10x.h"
#include "bsp_usart1.h"
#include "led.h"
extern unsigned char ch;
/**
* @brief ?÷oˉêy
* @param ?T
* @retval ?T
*/
int main(void)
{
//USART1_Config();
USART2_Config();
NVIC_Configuration();
LED_GPIO_Config();
while(1)
{
if(ch==0x01)
{
LED1(OFF);
}
if(ch==0x02)
{
LED1(ON);
}
}
}
/*********************************************END OF FILE**********************/
#include "stm32f10x.h"
#include "bsp_usart1.h"
#include "led.h"
extern unsigned char ch;
/**
* @brief ?÷oˉêy
* @param ?T
* @retval ?T
*/
int main(void)
{
//USART1_Config();
USART2_Config();
NVIC_Configuration();
LED_GPIO_Config();
while(1)
{
if(ch==0x01)
{
LED1(OFF);
}
if(ch==0x02)
{
LED1(ON);
}
}
}
/*********************************************END OF FILE**********************/
没有数据接收函数呢 只要串口接收中断函数写正确就可以了