Mikroelektronika MIKROE-742 데이터 시트
Soft_UART_Read
366
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
function Soft_UART_Read(var error: byte): byte;
Returns
Byte received via UART.
Description
The function receives a byte via software UART.
This is a blocking function call (waits for start bit). Programmer can unblock it by
calling Soft_UART_Break routine.
calling Soft_UART_Break routine.
Parameters :
-
error
: Error flag. Error code is returned through this variable.
0
- no error
1
- stop bit error
255
- user abort, Soft_UART_Break called
Requires
Software UART must be initialized before using this function. See the
Soft_UART_Init routine.
Soft_UART_Init routine.
Example
var data : byte;
error : byte;
...
// wait until data is received
repeat
// wait until data is received
repeat
data := Soft_UART_Read(error);
until (error=0);
// Now we can work with data:
if ( data ) then
begin
...
end
if ( data ) then
begin
...
end