Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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

Status
Not open for further replies.

npf

Newbie level 1
Joined
Mar 3, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
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

hi
npf

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 ..

Regards,
IanP
 

    V

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top