free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Rickey's World :: Discussion Forums :: Discuss and Learn :: 8051 Discussion Forum
 
<< Previous thread | Next thread >>
Serial Port Timing Issues With DS89C450
Moderators: Ajay Bhargav, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph, ExperimenterUK, DavesGarage
Author Post
Rouslan Nabioullin
Fri Jul 10 2009, 02:46PM
 User Offline
Registered Member #20175
Joined: Fri Jul 10 2009, 02:40PM

Posts: 2
Thanked 0 times in 0 posts
I am trying to get this serial port output sample program to work with the hardware I'm using (2400 baud, 12MHz xtal):

CODE:
#include <stdio.h>
#include <reg420.h>
// Initialize serial port 0 to 14400 baud (16.384MHz crystal)
serialInit()
{
TMOD = 0x21; // Timer 1: 8-bit autoreload from TH1
TH1 = 220; // 14400 baud rate
CKMOD = 0x38; // Use system clock for timer inputs
T2CON = 0x00; // Serial 0 runs off timer 1 overflow
TCON = 0x50; // Enable timers 0 and 1
SCON0 = 0x50; // Enable serial port 0
SBUF0 = ' ';
}
void main()
{
serialInit(); // Initialize serial port 0
printf("\rHello from the Keil C51 compiler\r");
while (1) {
printf("test1\r");
printf("test2\r");
}
}
 


Any ideas on what values I should modify the parameters to?



[ Edited Fri Jul 10 2009, 02:48PM ]
Back to top

Ajay Bhargav
Sat Jul 11 2009, 11:09AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7542
Thanked 1330 times in 1254 posts
you need to calculate timer reload value (TH1) for 12Mhz, 2400 baud.

check uart chapter of datasheet to find out how the clock works for this controller. if you face any problem do post here.. will help.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

Rouslan Nabioullin
Sun Jul 12 2009, 08:49AM
 User Offline
Registered Member #20175
Joined: Fri Jul 10 2009, 02:40PM

Posts: 2
Thanked 0 times in 0 posts
I found the UART timing characteristics on pages 9-10: http://datasheets.maxim-ic.com/en/ds/DS89C430-DS89C450.pdf
But I'm still unsure what values I should set the parameters to - I simply need a starting point so I could learn about the 8051 and UART timing once it actually works (i.e. prints actual text). Thanks in advance.

[ Edited Sun Jul 12 2009, 08:51AM ]
Back to top

Ajay Bhargav
Mon Jul 13 2009, 01:17PM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7542
Thanked 1330 times in 1254 posts
as you are using a ultra high speed controller from Dallas, there are many things to take care when using uart.. like mode of timer clock, CPU clock multiplier etc..

you need to go through page 42 of datasheet (link you posted) or download a detailed datasheet of this controller.

else keep everything default and use it like a generic 8051 controller where timer value is calculated as:

TH1 = 256-((2^SMOD)/32 * OscFrequency/(12*Baud))

so you get your reload value for timer.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems