-
- #include "STC8G_H_UART.h"
- #include <STC8G_H_Switch.h>
- #include "STC8G_H_Delay.h"
- #include <Seg.h>
- #include <String.h>
- #include <Config.h>
-
-
- void System_Init()
- {
- P_SW2 |= 0x80; //扩展外部XFR
- //P_SW1 |= (0x01<<6); //P36,P37作为串口1
- P3M0 = 0x00; P3M1 = 0x00;
- P3PU = 0x03;
-
-
- EA = 1;
- }
-
- void UART1_Init()
- {
- COMx_InitDefine Comx_InitStructure;
-
- Comx_InitStructure.UART_Mode = UART_8bit_BRTx;
- Comx_InitStructure.UART_BRT_Use = BRT_Timer1;
- Comx_InitStructure.UART_BaudRate = 115200UL;
- Comx_InitStructure.Morecommunicate = DISABLE;
- Comx_InitStructure.UART_RxEnable = ENABLE;
- Comx_InitStructure.BaudRateDouble = DISABLE;
-
- UART_Configuration(UART1,&Comx_InitStructure);
- UART1_SW(UART1_SW_P30_P31);
- }
- void main()
- {
- System_Init();
- UART1_Init();
-
-
- while(1)
- {
- TX1_write2buff(0x02);
- delay_ms(255);
- }
- }
复制代码
请问这个库函数配置串口有问题吗,为什么不能正常发送数据
|