本文介绍了PIC的UART问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i与UART有问题,当我从vb发送0并且PIC接收它并将其乘以100时它在LED上变为1111我使用PIC18F452并且有很多连续的UART阅读

任何人都可以帮助我????????



[从OP评论中添加]



这里是PIC中的阅读代码

hi
i have a problem with UART that when i send 0 from vb and the PIC receive it and multiply it by 100 it it become 1111 on the led i use PIC18F452 and have a lot of consecutive UART read
could any one help me ????????

[Added from OP comment]

here is the reading code in PIC

if (UART1_Data_Ready())
       {    a=0;

         for( a=0;a<3;a++)
         {
         ch_Rd= UART1_Read();
         b=ch_Rd;
         delay_ms(2);

         ch_Rd= UART1_Read();
           delay_ms(2);
         acc=ch_Rd;
         b+=acc*100;
         loc[a]=b;

          }



这里是VB的sening代码示例:


and here is a sample of sening code frome the VB :

serial1.Write(1)
        serial1.Write(2)
        serial1.Write(0)
        serial1.Write(3)
        serial1.Write(0)
        serial1.Write(4)
        serial1.Write(0)


当我在leds i上显示loc [1]的内容时
有类似的东西:11110011


when i display the content of loc[1] for example on leds i had something like:11110011

推荐答案


这篇关于PIC的UART问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 15:46