Mikroelektronika MIKROE-738 Datenbogen
596
mikoC PRO for PIC32
MikroElektronika
UARTx_Write
Prototype
void UARTx_Write(unsigned char data);
Description The function transmits a byte via the UART module.
Parameters -
Parameters -
data
: data to be sent
Returns
Nothing.
Requires
Routine requires at least one UART module.
Used UART module must be initialized before using this routine. See UARTx_Init and UARTx_Init_
Advanced routines.
Example
unsigned char data = 0x1E;
...
UART1_Write(data);
Notes
UART library routines require you to specify the module you want to use. To select the desired UART
module, simply change the letter
x in the routine prototype for a number from 1 to 6.
Number of UART modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.
UARTx_Write_Text
Prototype
void UARTx_Write_Text(char * UART_text);
Description Sends text via UART. Text should be zero terminated.
Parameters -
Parameters -
UART_text
: text to be sent
Returns
Nothing.
Requires
Routine requires at least one UART module.
Used UART module must be initialized before using this routine. See UARTx_Init and UARTx_Init_
Advanced routines.
Example
Read text until the sequence “OK” is received, and send back what’s been received:
UART1_Init(4800); // initialize UART1 module
Delay_ms(100);
while (1) {
if (UART1_Data_Ready() == 1) { // if data is received
UART1_Read_Text(output, “OK”, 10); // reads text until ‘OK’ is
found
UART1_Write_Text(output); // sends back text
}
}
Notes
UART library routines require you to specify the module you want to use. To select the desired UART
module, simply change the letter
x in the routine prototype for a number from 1 to 6.
Number of UART modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.