Quote Originally Posted by tenaja View Post
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
Hi,

Your code does not work with software UARTs.

Software UART routines use bit-banging techniques and can use almost any I/O pin
of the microcontroller. Software UARTs have big limitations and if the microcontroller has
hardware UARTs just use them!

Best regards,

Luciano