User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
626
UARTx_Write
Prototype
procedure UARTx_Write(data_ : word);
Description The function transmits a byte via the UART module.
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
var data_ : byte;
...
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 4.
Number of UART modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.
UARTx_Write_Text
Prototype
procedure UARTx_Write_Text(var uart_text : string);
Description Sends text via UART. Text should be zero terminated.
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:
// Read text until the sequence “OK” is received, and then send it back:
UART1_Init(9600);
delim := ‘OK’;
while TRUE do
begin
if UART1_Data_Ready() = 1 then
begin
UART1_Read_Text(txt, delim, 10);
UART1_Write_Text(txt);
end;
end;
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 4.
Number of UART modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.