uart 和 pic 18f452 的问题
我的 pic18f452 和 uart 有问题 我使用这样的最简单的代码:
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
在永远的 while 循环之间,我有这个代码,
UART1_Write_Text("HELLO2");
Delay_ms(1000);
我的硬件液晶模块中也有它,它工作得很好,但我在电脑上收到了数据 是这样的废品吗?
???m
我已经检查了所有连接,时间没有任何问题,我也更换了 MAX232 ic,但没有运气?! 我的硬件是这样的
最后我的所有连接都正常(极性和其他一切?) 编辑:我使用 mikroc 作为编译器
i have a problem with pic18f452 and uart
i use simplest code like that:
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
and between forever while loop i have this code
UART1_Write_Text("HELLO2");
Delay_ms(1000);
also i have in my hardware lcd module it works very fine but my received data on pc
is a scrap like that
???m
i have checked all connection sothand time nothing wrong also i have changed MAX232 ic but with no luck ?!
my hardware is like that
finall all my connections are ok (polarity and every thing else ?)
EDIT : i use mikroc as a compiler
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来像波特率错误。您是否检查过您的振荡器设置是否产生了预期的频率?您正在使用的串行库是否期望某个时钟频率并且您确定您正在该频率下运行,或者它是否在一组频率上工作并且您已正确告知串行库您正在使用什么频率?此外,将收到的字节视为十进制或十六进制数字而不仅仅是 ASCII 也会很有用。
Looks like a baud rate error. Have you checked that your oscillator settings are resulting in the expected frequency? Does the serial library you are using expect a certain clock frequency and you are sure that you are running at that frequency, or does it work over a set of frequencies and you have correctly informed the serial library what frequency you are using? Also it would be useful to see the byte received as a decimal or hex number rather than just ASCII.
起始位、数据位数、奇偶校验和停止位又如何呢?它们的两端相同吗?
What about the start bits, number of data bits, parity, and stop bits? Are they the same on both ends?
当您的连接松动时(即从最大 232 到 Pic & ),就会发生这种情况。从最大 232 到 PC。
尝试检查发送引脚或 usr 示波器上的波动,以查看 Hello World 字母表的 ASCII 值。
It happens when you have loose connections i.e. from max 232 to Pic & from max 232 to PC.
Try checking the fluctuations over the transmit pin or usr Oscilloscope to see the ASCII values of Hello World alphabets.