Search Projects


Final year degree project for engineers DAC0800 based project circuit diagram and interfacing with pic mirocontroller Final year projects based on microcontrollers on programmable peripheral interface 8255
Microcontroller based different projects abstract and source code
PIC 16f877 microcontroller projects Motion control
PIC16f877 motor controller and other light projects
Tutorials of microcontroller PIC16f877, A step by step easy to use self learning rapidex

Tuesday, July 6, 2010

Practical example soft uart using PIC microcontroller

Practical example of the use of soft-uart using PIC microcontroller:

The serial port of a PC (e.g., COM1) is connected to a PIC18F452 microcontroller, and terminal emulation software (e.g., HyperTerminal) is operated on the PC to use the serial port. Pins RB0 and RB1 of the microcontroller are the RX and TX pins respectively. The required baud rate is 9600.

Write a program to read data from the terminal, then increase this data by one and send it back to the terminal. For example, if the user enters character “A,” then character “B” should be displayed on the terminal. Assume that a MAX232-type voltage level converter chip is converting the microcontroller signals to RS232 levels. Figure shows the circuit diagram of this example.

The MAX232 chip receives the TX signal from pin RB1 of the microcontroller and converts it to RS232 levels. Comparably, the serial data received by the MAX232 chip is converted into microcontroller voltage levels and then sent to pin RB0. Note that correct operation of the MAX232 chip requires four capacitors to be connected to the chip.
The required program listing is shown in Figure 4.24 (program SERIAL.C). At the beginning of the program, function Soft_Uart_Init is called to configure the serial port. Then an endless loop is formed using a for statement. The Soft_Uart_Read function is called to read a character from the terminal. After reading a character, the data byte is incremented by one and then sent back to the terminal by calling function

void main()
unsigned char MyError, Temp;
Soft_Uart_Init(PORTB, 0, 1, 9600, 0);
for(; ;)
Temp = Soft_Uart_Read(&MyError); // Read a byte
} while(MyError);
Soft_Uart_Write(Temp); // Send the byte
// Increment byte


Siva Kumar said...

The Pin numbers you mentioned for RX and TX is wrong. In PIC 18F452 the pin numbers are 26 and 25 for RX, TX respectively

Anonymous said...

Pretty! This has been a really wonderful article.

Many thanks for providing these details.

m.yasir said...

which PIC C compiler you have used in this implementation?

Post a Comment

Hi: This is comments section. Here you are requested to write your question or problems in detail. Write the question in such a way that, it have all necessary information, sothat i can understand and reply.If you want to send pictures and codes then e-mail me (