Author Topic: [SOLVED] Uart0Receive() Read  (Read 435 times)

kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: Uart0Receive() Read
« on: June 18, 2016, 12:42:32 pm »
I have made a simple test with my touchscreen and mcModule

The screen is sending 01 02 03
And there is a simple calculation 1+2+3-1 so the result should be 5 as you could see in the provided movie the result is 5 every time i debug the code and when i let it go by it self then this time the result was 4.

So what do you think about this?

https://youtu.be/gTFz461KB1Q

By the way this might be the most boring movie that you ever have seen but maybe it provides some good information to this case.  ;)

Code: [Select]
Class UartExample
    Shared serial As Uart
    Shared Event Boot()
        // Enable serial communication
        serial = Uart.Create(9600, Pin.Pin3, Pin.Pin1)
    End Event
   
   
    Shared Event Uart0Receive()
        Dim chr As Integer = serial.Read
        Dim test As Integer = chr
       
        While chr >= 0
           
            chr = serial.Read()
            test = test + chr
        End While
    End Event
End Class