Hi,
Why not use inkey to grab individual Bytes, that you copy into an Array and when youget the end of message character process the message.
I quite often put the Serial Input processing in a uart receive ISR that handles to low Level processingand passes "complete" Messages to the main app.
something like
[code:1:76b45e47b5]
Rfid_char = Inkey(#1) 'Read serial char
If Rfid_char = 2 Then 'Chr 2 - Start of MSG
Rfid_ptr = 0 'Reset pointer
End If
Incr Rfid_ptr 'Move to next byte
Rfid_array(rfid_ptr) = Rfid_char 'Save char to array
If Rfid_ptr = 13 Then 'and correct length
Rfid_have_buffer = 1 'tell user space
Rfid_ptr = 0 'Reset buffer
End If
[/code:1:76b45e47b5]
Regards
Ian Dobson
↧