完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在PIC32控制器上工作。我使用USART1传输字符串“WELCOME TO WORLD”。当我传输整个字符串时,另一端(PC上的超终端)显示WELCOWELCOME TO WORLD。上述问题只发生于第一个STRIGN。PIC32 USATAR1被配置为8个数据位、奇偶校验位和1个停止位。外围时钟是40MHZ.是硬件问题还是软件问题?
以上来自于百度翻译 以下为原文 I am working on PIC32 controller. I am using USART1 to transmit character string "WELCOME TO WORLD". When i transmit entire string, at other end( hyperterminal on PC) shows WELCOWELCOME TO WORLD. the above problem occurs only for first string. PIC32 USART1 is configured for 8 data bits, odd parity and 1 stop bit. peripheral clock is 40MHz. is it problem of hardware or of software? |
|
相关推荐
7个回答
|
|
|
|
|
|
代码有错误。看门狗设置不当,或者其他问题。发送例程如何工作,轮询或中断?
以上来自于百度翻译 以下为原文 Bug in your code. Improper setting of Watchdog, or any of a myriad of other problems. How does your transmit routine work, with polling, or interrupts? |
|
|
|
|
|
|
|
这是我的代码:int main(void){charStriString1(char String1[]="按任意键到听力ECO";SYSTEMConconfi(SYS_FREQ,SYS_CFG_WAIT_STATES_SYS_CFG_WAIT_CFG_CFG_PCACHE);//40MHzPBCLK频率被设置为UART1Init();UARTSendStridStringStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStriStri(1);返回0;返回0;返回0;返回0;返回0;返回0;返回0;返回0;返回0;返回0;空UART1InInInInRT1InInInInInInInInInInInInInInInInInInInIn21;//波特率115200;U1MODE/ODD PARITY,1ST停止位,8个数据位U1MODE 1MODE=U1MODE U1MODE数据位U1MODE=U1MODE和amp;~(0x00000000003);//U1MODE=U 1模式U1MODE U1MODE U1MODE U 1模式U1MODE速率U1MODE U1MODE U 1模式U1MODEU1MODEU1MODEU0x0000000000000000000404;//STD波特波特波特率U1MODE U1MODE U 1模式U1MODE U 1模式U1MODE U 1模式U 1模式U1MODE U 1模式U1MODE U 1模式和amp;;~(0x00000000000000000000000000000000000000000000300;////TX发送U1MODE=U1MODE|0x00008000;//启用UART}无效UARTStEnStstring(char * StRING1){int i=0,j=0;而(Strug1)!=(’0’){(U1Stest.UTXBF);U1TxReg=x;I++;}同时(!)U/Stimt;//检查上次事务完成*/} 以上来自于百度翻译 以下为原文 Here is my code: int main(void) { char String1[]="PRESS ANY KEY TO HEAR ECO"; SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);// 40MHz PBCLK frquency is set UART1Init(); UARTSendString(String1); while(1); return 0; } void UART1Init() { U1MODE=0; U1STA=0; U1BRG=21; // BAUD RATE 115200; U1MODE=U1MODE | 0x00000004; // ODD PARITY, 1 STOP BIT, 8 DATA BITS U1MODE=U1MODE & ~(0x00000003); // U1MODE=U1MODE &~(0x00000008); // STD BAUD RATE U1MODE=U1MODE & ~(0x00000300); // TX RX MODE U1STA= U1STA | 0x00000400; // ENABLE TRANSMISSION U1MODE= U1MODE | 0x00008000; // ENABLE UART } void UARTSendString(char *String1) { int i=0,j=0; while(String1!=' |