I tried this code:
and it still doesn't work any ideea why.Code:ReadSerial: DataRec var byte[5] : DataRec = 0 KP var byte : KP = 0 While CounterA <= 70 IF index_in > (buffer_size-1) Then index_in = 0 'Reset pointer if outside of buffer HSerin [buffer[index_in]] ' Read USART and store character to next empty location if buffer(index_in) = $20 then index_in = 0 for CounterB=0 to buffer_size buffer(CounterB) = 0 next CounterB KP = 1 ENDIF if ((KP = 1) AND (index_in=4)) THEN SerData(CounterA)=buffer(4) CounterA = CounterA + 1 KP = 1 ENDIF index_in = index_in + 1 WEND
PS: Is it better than the old one?




Bookmarks