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.

quetion in serial communication with at89c52

Status
Not open for further replies.

mahran

Newbie level 4
Joined
Apr 10, 2004
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
56
at89c52+baud rate+2400

im using microcontroller atmel at89c52
i need to make an interface with pc via serial port and i'm using max232
the question is what kind of crystal needed to do that i mean the frequency of the crystal.
thanks,
 

crystal frequency of at89c52

Hi,
You can go through the datasheets of AT89C52 on www.atmel.com

I have used 11.0592 MHz Crystal with 89C52 and I can get baud rates of 1200,2400, 4800,9600,19200.
In the datasheet, the Section of Serial Ports in 89C52 explains how to initialize the serial port, and its baudrate using Timer 1.

With a 12.00MHz crystal you can get 9600 using Timer2 of 89C52. I have used this just once for 9600 Baud. Never tried for other Speed. But the manual gives you the formula for other Baudrates.

So happy programming,
Mr. Kiran V. Sutar
 

Salam,

For 11.0592Mhz you can get 1200,1400,4800,9600,19200

For 12Mhz you can get 4800 (using Timer1)

So 11.0592 Crystal is better to get accurate baudrate.

Bye
 

I think choosing freq. of crystal is not inportant. It's more important that at what baud rate you want to communicate with series port. Once you determined baud rate you need, then you can choose what crystal should be used.
Further detail about how to calculate baud rate can be found in some book about "Microcontroller 8051 or 8052"
 

thanks to all for replying
i tried crystals with 12Mhz ,11.059Mhz ,22.11Mhz and configured my baud rate
tha data already sent from the serial port successfully and received by MAX232 i made the connection of MAX232 typically as its datasheet but the uC didn't respond :cry:
 

mahran said:
thanks to all for replying
i tried crystals with 12Mhz ,11.059Mhz ,22.11Mhz and configured my baud rate
tha data already sent from the serial port successfully and received by MAX232 i made the connection of MAX232 typically as its datasheet but the uC didn't respond :cry:
You transmitted and received successfully from your series port, but how you set up your series port rate?
Baud rate of series port should be equal to baud rate of uC. If you set up series port rate too high, you can transmit or receive data at MAX232, but you uC may not receive? So, you should check what baud rate of your series port first.
 

huynh said:
Once you determined baud rate you need, then you can choose what crystal should be used.
Hi,

I think it is important, cause you not always find the right frequency...

Cheers !
 

tha data already sent from the serial port successfully and received by MAX232 i made the connection of MAX232 typically as its datasheet but the uC didn't respond

If I understand well mcu send data to PC but other way dont work.

1. Check cable between PC and mcu (Rx, Tx and GND).
2. Check baudrate in PC in hyper terminal
3. Check max232 and signals around them.
4. Look on your sending routine (best support you can get if you send us source code with comments so people can point you the problem).
5. if you use LCD you can write on display what you get if you get anything.


Mr.Cube
 

Did you check the TI flag? id it's not activated by the HW uart, tere is nothing sent from the uC itself. else, check the serial format (Baud, Start & Stop bits, data byte width).

I use ViewComm to check my serial links, and most cases, it's a software bug.
 

the baud rate was configered in uController and PC
but i finally solved the problem and the circuit works properly :eek:
i think yhe problem was with MAX232 ,since i need only to receuive the data from my pc via serial port and don't need to transmit data from uController to PC i replaced the MAX232 with a single level converting circuit, this circuit is very simple it consists of a doide(1N4148) and transistor(QCS9014)and 2 resistor ,this circuit works properly with me
and the interface done successfully :eek:
anyway thanks to everybody for helping and replying.
 

im using microcontroller atmel at89c52. i need to make an interface with sensor via serial port
I have used 11.0592 MHz Crystal but I can’t get baud rates 19200
Is there any problem with this code for serial please?
; FUNCTIONS/SUBROUTINES
SERIAL1:
MOV A,PCON
SETB ACC.7
MOV PCON,A
MOV TMOD,#20H ; timer1 mode 2
MOV TH1,#0FDH
MOV SCON,#50H ;8-BIT, 1 STOP BIT, REN ENABLED
SETB TCON.6
CLR TI
MOV SBUF,A
H_1:JNB TI,H_1
RET
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top