Good evening.
I have a micro sending a byte every 10ms (max) at 9600 baud thru an ftdi device.
Four different bytes are sent 0x0X, 0x1X, 0x2X, 0x3X and 0x4X
upper nibble (0,1,2 = time counting down in secs, 10th of sec and 100's of sec)
Lower nibble is 0-9
0x3X and 0x4X are the scores (tens and units), again X is 0-9.
The code below works, but misses bytes - Realterm for PC shows me the bytes are there B4A logs show me the bytes are missing.
Am I asking too much ?
Do I need to make an array ?
can I speed things up anyway ?
Thanks in advance.
Private Sub serial_DataAvailable (Buffer() As Byte)
Dim y As Int
y=ToUnsigned(Buffer(0))
Log("y= " & y )
Select True
Case y<10
TimeH.Text=y
Case y<32
y=y-16
TimeT.Text=y
Case y<48
y=y-32
TimeU.Text=y
Case y<64
y=y-48
CountH.Text=y
Case y>63
y=y-64
CountL.Text=y
End Select
End Sub
Sub ToUnsigned(b As Byte) As Int
Return Bit.And(0xFF, b)
End Sub