Trying to implement a "console like" behavior but cannot get it to work.
I'm using RX_Ready to read USB and then entering the desired reaction regarding the received command. However it seems that after doing an USBIn command, RX_Ready does not stay = 0 for very long, even if absolutely no data is received.
Is RX_Ready indicating a capacity to receive data (buffer not full), just like TX_Ready? In that case I cannot use this to trigger an event upon packet receive...
To better explain it here is some very dirty code.
I'm confused yet about very simple things, like how to clear the buffer between requests. Also here it is polled every seconds, because I do not know how to trigger the event upon packet received... Tried to look for helpful examples without any luck.Code:MainLoop: ARRAYWRITE USBBuffer, [">"] GOSUB DoUSBOut GOSUB DoUSBIn SELECT CASE USBBuffer [0] CASE "A", "a" GOSUB EchoData ARRAYWRITE USBBuffer, ["OK", 10, 13] Gosub DoUSBOut CASE ELSE GosuB EchoData ARRAYWRITE USBBuffer, ["Error", 10, 13] GOSUB DoUSBOut END SELECT PAUSE 1000 GOTO MainLoop '******************************************************* 'Echo sent frame back '******************************************************* EchoData: GOSUB DoUSBOut ARRAYWRITE USBBuffer, [10, 13] GOSUB DoUSBOut RETURN




Bookmarks