大家帮我看看这个程序有什么问题 它能通过编译 但是串口调试助手不显示接收数据 这是程序是 测模拟电压 然后通过AD转换 然后用串口发送 显示在PC上……
#include "stm8s.h"
#include "system.h"
#include "stm8s_uart2.h"
#include "stm8s_adc1.h"
u32 ReceiveData;
main()
{
UART2_Init(9600, UART2_WORDLENGTH_8D ,UART2_STOPBITS_1, UART2_PARITY_NO , UART2_SYNCMODE_CLOCK_DISABLE,UART2_MODE_TXRX_ENABLE );
ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS , ADC1_CHANNEL_7 ,ADC1_PRESSEL_FCPU_D2, ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGHT,ADC1_SCHMITTTRIG_CHANNEL1, DISABLE);
UART2_Cmd(ENABLE);
while(1)
{
ADC1_StartConversion();
while((ADC1->CSR & 0x80 ) == 0x80)
{ ReceiveData=ADC1_GetConversionValue();
UART2_SendData8(ReceiveData);
}
}
}
|