使用RF_PHY 時用到了串口,使用串口是發(fā)現(xiàn)接收端只能接收到長字節(jié)數(shù)據(jù)的前8位字節(jié),推斷是UART1_ByteTrigCfg(UART_7BYTE_TRIG);中UART_7BYTE_TRIG參數(shù)導致的,這個量能變大嗎?還是只能接收前8個字節(jié)?
還是說是一種可能把長字節(jié)拆分成若干8字節(jié)發(fā)送?那我想要識別數(shù)據(jù)的第一位和第十位該怎么辦?
串口初始化如下:
void?Uart_Init(void) { ????uint8_t?len; ????/*?配置串口1:先配置IO口模式,再配置串口?*/ ????GPIOA_SetBits(GPIO_Pin_9); ????GPIOA_ModeCfg(GPIO_Pin_8,?GPIO_ModeIN_PU);??????//?RXD-配置上拉輸入 ????GPIOA_ModeCfg(GPIO_Pin_9,?GPIO_ModeOut_PP_5mA);?//?TXD-配置推挽輸出,注意先讓IO口輸出高電平 ????UART1_DefInit(); ????UART1_ByteTrigCfg(UART_7BYTE_TRIG); ????trigB?=?20; ????UART1_INTCfg(ENABLE,?RB_IER_RECV_RDY?|?RB_IER_LINE_STAT); ????PFIC_EnableIRQ(UART1_IRQn); } /********************************************************************* ?*?@fn??????UART1_IRQHandler ?* ?*?@brief???UART1中斷函數(shù) ?* ?*?@return??none ?*/ __INTERRUPT __HIGH_CODE void?UART1_IRQHandler(void) { ????volatile?uint8_t?i; ????PRINT("IRQ?RIGHT\n"); ????switch(UART1_GetITFlag()) ????{ ????????case?UART_II_LINE_STAT:?//?線路狀態(tài)錯誤 ????????{ ????????????UART1_GetLinSTA(); ????????????break; ????????} ????????case?UART_II_RECV_RDY:?//?數(shù)據(jù)達到設置觸發(fā)點 ????????????for(i?=?0;?i?!=?trigB;?i++) ????????????{ ???????????????RxBuff[i]?=?UART1_RecvByte(); ????????????} ????????????tmos_set_event(taskID,?SBP_RF_COMMAND_EVT); ????????????break; ????????case?UART_II_RECV_TOUT:?//?接收超時,暫時一幀數(shù)據(jù)接收完成 ????????????i?=?UART1_RecvString(RxBuff); ????????????tmos_set_event(taskID,?SBP_RF_COMMAND_EVT); ????????????break; ????????case?UART_II_THR_EMPTY:?//?發(fā)送緩存區(qū)空,可繼續(xù)發(fā)送 ????????????break; ????????case?UART_II_MODEM_CHG:?//?只支持串口0 ????????????break; ????????default: ????????????break; ????} }
熱門產(chǎn)品 :
USB3.0 HUB控制器:CH634