ABL electronic PIC16 Personal Computer User Manual


 
mikroC provides library which implements software UART. These routines are
hardware independent and can be used with any MCU. You can easily communi-
cate with other devices via RS232 protocol – simply use the functions listed
below.
Note: This library implements time-based activities, so interrupts need to be dis-
abled when using Soft UART.
Soft_Uart_Init
Soft_Uart_Read
Soft_Uart_Write
MikroElektronika:
Development
tools
-
Books
-
Compilers
26 1
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
Software UART Library
Library Routines
Prototype
void Soft_Uart_Init(unsigned short *port, unsigned short rx,
unsigned short tx, unsigned short baud_rate, char inverted);
Description Initalizes software UART. Parameter port specifies port of MCU on which RX and TX
pins are located; parameters rx and tx need to be in range 0–7 and cannot point at the
same pin; baud_rate is the desired baud rate. Maximum baud rate depends on PIC’s
clock and working conditions. Parameter
inverted, if set to non-zero value, indicates
inverted logic on output.
Soft_Uart_Init needs to be called before using other functions from Soft UART
Library.
Example
Soft_Uart_Init(&PORTB, 1, 2, 9600, 0);
Soft_Uart_Init