main( ) { UINT8 re_butter = 0; UINT8 tx_butter ; UINT8 a_flag; UINT8 b_flag; UINT8 c_retain = 0; UINT8 d_retain = 0; UINT8 power_flag; //CfgFsys( ); //CH559时钟选择配置 mDelaymS(5); //等待内部晶振稳定 P4_DIR = 0xff; CH559GPIOModeSelt(3,1,2); CH559GPIOModeSelt(3,1,4); CH559GPIOModeSelt(0,1,5); CH559GPIOModeSelt(3,2,3); CH559GPIOModeSelt(3,2,5); mInitSTDIO( ); //串口0,可以用于调试 printf("start ...\n"); P3_3 = 1; P3_5 = 0; XBUS_AUX |= bALE_CLK_EN; //关闭RS485模式 RS485_EN = 0; SER1_IER |= bIER_PIN_MOD1| bIER_PIN_MOD0; //中断使能寄存器,脚位设置P2.6和P2.7,TNOW(P2.5) RXD1_ = 1; //CH559GPIOInterruptInit(); IE_GPIO = 1; //使能GPIO中断 EA = 1; //使能全局中断 while(1){ re_butter = CH559UART0RcvByte(); CH559UART0SendByte(re_butter); } }
这是写的程序 UART0可以发送数据 但 无法接收到数据
热门产品 :
CH32V317: 互联型青稞RISC-V MCU