Mikroc, Usart_data_ready, Usart_read – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 280

Advertising
background image

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

272

MikroElektronika: Development tools - Books - Compilers

page

Prototype

char

Usart_Data_Ready(void);

Returns

Function returns 1 if data is ready or 0 if there is no data.

Description

Use the function to test if data is ready for transmission.

Requires

USART HW module must be initialized and communication established before using
this function. See

Usart_Init

.

Example

int

receive;

...

// If data is ready, read it:

if

(Usart_Data_Ready()) receive = Usart_Read;

Usart_Data_Ready

Prototype

char

Usart_Read(void);

Returns

Returns the received byte. If byte is not received, returns 0.

Description

Function receives a byte via USART. Use the function

Usart_Data_Ready

to test if

data is ready first.

Requires

USART HW module must be initialized and communication established before using
this function. See

Usart_Init

.

Example

int

receive;

...

// If data is ready, read it:

if

(Usart_Data_Ready()) receive = Usart_Read;

Usart_Read

Advertising
This manual is related to the following products: