Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to write the c code for communication between 2 microC

Not open for further replies.


Newbie level 1
Mar 3, 2006
Reaction score
Trophy points
Activity points
interrupts codings in microc

hi, i have no idea how to write the serial communication code between 2 AT89s51 microcontroller in C code using intterupt. can anyone help me..?

if i have a keypad connect to one microcontroller and a dotmatrix display unit connect to another microcontroller. The hexa value that i get from the key press code, can i use serial communication to transfer the hex value to the display unit's microcontroller...?

wat should i consider when i using serial communication interrupt to transfer data from one microcontroller to another microcontroller.

can anyone help me...?thanks..

interrupt based serial communication in microc


H/W configuration
connect Rx mc1 to Tx mc2
connect Tx mc1 to Rx mc2
No need of any level shifting unless it is at far distance.

S/W protocol.
Enable serial interrupt on display side microcintroller.

keep checking a flag indicating that serial buffer is full.

On every serial interrupt,
receive byte and check is it a start byte,
if yes then store it, and enable flag saying that check foe end byte now.
now on every serial interrupt store that byte, till u get end byte,
After receiving end byte set flag serial buffer is full.

since u r in checking process of Serial buffer full, u will get out of it and process that data received in serial buffer,
mean while set serial buffer empty, to enable next serial buffer,

Selection of BAUD RATE.
Select baud such that u have ample time for processing,
Example:9600 baud will take 1mSec to get one byte. with uC we can do a lot in 1mSec.

interrupt microc

In the attached PDF (source uknknown) you will find examples in 8051-C on:

int.c - A rewrite of the serial example to use interrupts in C ..
serial.c - Example of how to read and write data on the 8051 serial port using polling ..



    Points: 2
    Helpful Answer Positive Rating
Not open for further replies.

Part and Inventory Search

Welcome to