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.

89C51, 89C2051, Serial data using C

Status
Not open for further replies.

Micro Lover

Member level 2
Joined
Jul 22, 2009
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
pakistan
Activity points
1,614
Hi

I am designing digital clock using 89c51, approximately every thing is complete successfully, but I want to make a one master clock that will send serial data to slave clocks, and slave clocks will show that received data. In the slave clocks I want to use 89C2051, due to its small size. I am not a student, and I have not too much background knowledge about electronic, I want to make it for a fun.

Problem.
-----------
How can I send (serial) data using 89C51, and receive it using 89C2051.
e.g

unsigned char sec=55, min=58, hour=23

How can I send “55”, “58” and “23”.

And how can I receive it
 

Using the RX and TX pins in the microcontrollers you can communicate and also by using the UART program.
 

Hi

hope it can help you.. just apply this code... I've been using this some of my problems...

PHP:
unsigned char serial_read() // read single byte from UART
{
	unsigned char ch;
	while(!RI);			//waits till a byte is recieved
	ch = SBUF;
	RI = 0;
	return(ch);
  
}

/* function to send char */
void serial_send(unsigned char send)
{
	SBUF = send;
	while(!TI);
	TI = 0;
}

/* function to send string */
void serial_sendstr(unsigned char *p)
{
	while(*p!='\0')
	serial_send(*p++);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top