
Originally Posted by
tenaja
I don't use Mikrobasic, but here is an easy way to do it without interrupts...just translate the code to proper syntax. (And set the symbols of cTxReg etc. to the appropriate values. Leading characters are: c=constant, b=byte.)
bDelayTime = 0
CheckForData:
if cTxReg = cDataWaiting then 'check hardware Tx register for incoming data.
serin = bSerialDataIn 'get data...
goto SerialDataReceived
else 'no data waiting...
pause 1 'wait 1ms...change to match your baud rate, since some speed may overwrite
bDelayTime = bDelayTime + 1
if bDelayTime = cMaxWaitTime then
goto NoSerialDataReceived
endif
goto CheckForData
endif
Bookmarks