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.

[SOLVED] [Moved] UART serial communication in 89c52

Status
Not open for further replies.

visva

Member level 3
Member level 3
Joined
Jul 26, 2012
Messages
55
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,633
how can set baud rate for communication in UART(with calculation). And what about range of baud rate. how to send data through TXD pin. Any example program in c for 89c52
 

Re: UART serial communication in 89c52

Have a look at this tutorial - it is quite informative:
**broken link removed**
 
  • Like
Reactions: visva

    visva

    Points: 2
    Helpful Answer Positive Rating
Re: UART serial communication in 89c52

thank you. can i have any simple c program for UART(89c52)
 

Re: UART serial communication in 89c52

i have tried above website. i could understood serial communication. But that process is working continuously. i want to stop that process after sending my data(its working like loop).
 

Re: UART serial communication in 89c52

If you don't want continuous polling of the serial port you will have to start using interrupts.
Work through this tutorial and then implement a Serial Interrupt routine.
**broken link removed**
 
  • Like
Reactions: visva

    visva

    Points: 2
    Helpful Answer Positive Rating
Re: UART serial communication in 89c52

i have studied about UART and INTERRUPT(priority of interrupt, tcon,tmod,scon,pcon).But i dont know how to implement in C program. please any one upload or explain how to do the program in c(procedure).
 

i am also having this book. But i have doubt in that. here Why we are using WAVE(p0.1 pin). what is " void timer0() interrupt 1" function, what is the purpose of this function and where we are calling from in the main. the same doubt in "void serial0() interrupt 4". so explain fully how it is working.

Code:
#include <reg51.h>
sbit WAVE =P0^1;
void timer0() interrupt 1
 {
         WAVE=~WAVE; //toggle pin
}
void serial0() interrupt 4
 {
      if (TI==1) 
      {
                 TI=0; //clear interrupt
       }
      else 
      {
               P0=SBUF; //put value on pins
              RI=0; //clear interrupt
        }
}
void main()
 {
           unsigned char x;
           P1=0xFF; //make P1 an input
           TMOD=0x22;
            TH1=0xF6; //4800 baud rate
            SCON=0x50;
            TH0=0xA4; //5 kHz has T=200us
            IE=0x92; //enable interrupts
            TR1=1; //start timer 1
            TR0=1; //start timer 0
             while (1)
            {
                        x=P1; //read value from pins
                        SBUF=x; //put value in buffer
                         P2=x; //write value to pins
            }
}
 
Last edited:

any one explain previous program
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top