| Author |
Message |
Livingston
Joined: 26 Nov 2007 Posts: 121 Helped: 2 Location: Chennai-India
|
27 Nov 2007 13:32 minimum circuit of 89c2051 |
|
|
|
|
Hai,
I have designed a simple circuit to display some character in the p.c.
That circuit contains one max232 circuit and basic working circuit fo 89c2051(contains 11.0592 crystal with two 33pf and 8,3k ohms and 10µf for reset pin).
The program is executing well (tested with 89c51 controller) but if i programmed the same code in 89c2051 there is no output from the uart
The baurd rate is 9600bps
/*------------------------------------------------------------------------------
Serial.c
------------------------------------------------------------------------------*/
#include <REG52.H> /* special function register declarations */
/* for the intended 8051 derivative */
#include <stdio.h> /* prototype declarations for I/O functions */
#ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
/* is enabled */
/*------------------------------------------------
The delay function
------------------------------------------------*/
void Delay (const unsigned int DELAY)
{
unsigned int x, y;
for (x = 0; x <= DELAY; x++)
{
for (y = 0; y <= 120; y++);
}
}
/*------------------------------------------------
The main C function. Program execution starts
here after stack initialization.
------------------------------------------------*/
void main (void) {
/*------------------------------------------------
Setup the serial port for 9600 baud at 11.0952 MHz.
------------------------------------------------*/
#ifndef MONITOR51
SCON = 0x42; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0xFD; /* TH1: reload value for 9600 baud @ 11.0592 MHz */
TR1 = 1; /* TR1: timer 1 run */
TI = 1; /* TI: set TI to send first char of UART */
#endif
/*------------------------------------------------
Note that an embedded program never exits (because
there is no operating system to return to). It
must loop and execute forever.
------------------------------------------------*/
while (1)
{
P1 ^= 0x01; /* Toggle P1.0 each time we print */
Delay(1000);
printf ("Livingston\n"); /* Print "Livingston" */
}
}
Last edited by Livingston on 03 Dec 2007 13:15; edited 3 times in total |
|
| Back to top |
|
 |
nandhu015
Joined: 11 Feb 2006 Posts: 647 Helped: 47 Location: Tamilnadu, India
|
28 Nov 2007 2:47 execution circuit for 89c51 |
|
|
|
|
How much is your code size
89c51 has 8kb of flash while 89c2051 has only 2kb of flash
| Quote: |
The baurd rate is 9600mhz
|
It is not 9600mhz it is 9600bps
Regards
Nandhu
|
|
| Back to top |
|
 |
funnynypd
Joined: 09 May 2007 Posts: 919 Helped: 21 Location: USA & Canada
|
28 Nov 2007 21:11 89c2051 tmod |
|
|
|
|
| curious why not use some frequency such as 8M, 12M, 16M or 20MHz?
|
|
| Back to top |
|
 |
nandhu015
Joined: 11 Feb 2006 Posts: 647 Helped: 47 Location: Tamilnadu, India
|
29 Nov 2007 3:01 Re: Interfacing 89c2051 |
|
|
|
|
The 89c51 controllers divide the clock frequency by 12 internally.
To achieve minimum errors at all (most of) baud rates the 11.0592 MHz crystal suites the best.
You can also use any other oscillator but with some error in baud rate.
Regards
Nandhu
|
|
| Back to top |
|
 |
sashijoseph
Joined: 04 Jul 2006 Posts: 17
|
01 Dec 2007 17:56 Re: Interfacing 89c2051 |
|
|
|
|
| Is Port1 toggling as provided for in the code?
|
|
| Back to top |
|
 |
Livingston
Joined: 26 Nov 2007 Posts: 121 Helped: 2 Location: Chennai-India
|
03 Dec 2007 5:34 Re: Interfacing 89c2051 |
|
|
|
|
| sashijoseph wrote: |
| Is Port1 toggling as provided for in the code? |
No, all the ports are high.
|
|
| Back to top |
|
 |
Google AdSense

|
03 Dec 2007 5:34 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
sashijoseph
Joined: 04 Jul 2006 Posts: 17
|
04 Dec 2007 4:00 Re: Interfacing 89c2051 |
|
|
|
|
| Just to check if the setup is working fine,comment out the printf and see if P1.0 toggles.
|
|
| Back to top |
|
 |
Livingston
Joined: 26 Nov 2007 Posts: 121 Helped: 2 Location: Chennai-India
|
04 Dec 2007 5:29 Re: Interfacing 89c2051 |
|
|
|
|
| sashijoseph wrote: |
| Just to check if the setup is working fine,comment out the printf and see if P1.0 toggles. |
But still there is no result.
|
|
| Back to top |
|
 |