EmbeddedRelated.com
Forums

8051 newbie

Started by Unknown December 12, 2005
This question was asked before.

>Hi,
>I would like to try out the projects in the book "Microcontroller Projects >in C for the 8051". The book provides the hardware circuit and code for the >project. As a newbie in microcontroller, how to transfer the code to the >8051 (the book did not provide this information) ?
>Any pointer is appreciated.
>Thanks in advance,
I have a ChipMax (parallel programmer). I have the AT89C4051 which is a similar chip described in the book(2051). No matter what I try all pins are high except two. pins 12 and 13 the analog comaparator pins. The power supply is 5.5V. Which is between 4-6 V range Atmel publishes. I do not know what the problem is. Has anybody experienced this before. The only thing that I can think of is that the voltage is too high. I have tried on several chips and the same results. ALSO sometimes when I program the chip I get the "error device does not match". And it will do that for several chips. And then it will work for those same chips, without changing any of the options. I hoped it was the programmer but I was able to read the chips and get the same program I had uploaded.
richardscheff@gmail.com wrote:
> This question was asked before. > >> Hi, > > >> I would like to try out the projects in the book "Microcontroller Projects >> in C for the 8051". The book provides the hardware circuit and code for the >> project. As a newbie in microcontroller, how to transfer the code to the >> 8051 (the book did not provide this information) ? > > >> Any pointer is appreciated. > > >> Thanks in advance, > > I have a ChipMax (parallel programmer). I have the AT89C4051 which is > a similar chip described in the book(2051). No matter what I try all > pins are high except two. pins 12 and 13 the analog comaparator pins. > > The power supply is 5.5V. Which is between 4-6 V range Atmel > publishes. > > I do not know what the problem is. Has anybody experienced this > before. The only thing that I can think of is that the voltage is too > high. > > I have tried on several chips and the same results. > ALSO > sometimes when I program the chip I get the "error device does not > match". And it will do that for several chips. And then it will work > for those same chips, without changing any of the options. > > I hoped it was the programmer but I was able to read the chips and get > the same program I had uploaded. >
what are you trying to do? program the chip? or run a program from the chip. I used the 2051 version. your osc connected, reset pin at the right level? rw
The oscilator is 20MHz.  Should that make a difference.
I have tried the reset connected to a cappacitor to 5V.
And I have tried the reset connected to ground.
Atmel says the reset is suposed to be raised high for 2 machine cycles
and then set low.
So I have manually raised it and set it low.
That has no effect.

richardscheff@gmail.com wrote:
> The oscilator is 20MHz. Should that make a difference. > I have tried the reset connected to a cappacitor to 5V. > And I have tried the reset connected to ground. > Atmel says the reset is suposed to be raised high for 2 machine cycles > and then set low. > So I have manually raised it and set it low. > That has no effect. >
20 MHz should be ok, but check the marking on the chip. I had them in 14MHz also. Reset: I connect pin 1 10uF or so to +5V and 10k to ground. rw
Ryan Weihl wrote:
> richardscheff@gmail.com wrote: >> The oscilator is 20MHz. Should that make a difference. >> I have tried the reset connected to a cappacitor to 5V. >> And I have tried the reset connected to ground. >> Atmel says the reset is suposed to be raised high for 2 machine cycles >> and then set low. >> So I have manually raised it and set it low. >> That has no effect. >> > 20 MHz should be ok, but check the marking on the chip. > I had them in 14MHz also. > Reset: I connect pin 1 10uF or so to +5V and 10k to ground. > rw
oh ' make sure you have an "F" on the bottom side. there was a note from atmel in 2002 that any 2051 before revision "F" had a problem about high current when shut off. rw
Ryan Weihl wrote:
> richardscheff@gmail.com wrote: >> The oscilator is 20MHz. Should that make a difference. >> I have tried the reset connected to a cappacitor to 5V. >> And I have tried the reset connected to ground. >> Atmel says the reset is suposed to be raised high for 2 machine cycles >> and then set low. >> So I have manually raised it and set it low. >> That has no effect. >> > 20 MHz should be ok, but check the marking on the chip. > I had them in 14MHz also. > Reset: I connect pin 1 10uF or so to +5V and 10k to ground. > rw
found this in my bookmarks: www.iguanalabs.com/2nd2051.htm re
I set up my circuit exactly as you described.  It still does not work.
I was hoping someone might have experienced this problem and know the
solution.  All pins are high except for the two analog comparators.

I was looking at the circuit sschematic with the LEDs.  It looks like
the 8051 is acting as the ground for the LEDs and not the power supply.
 Does that mean that pins are designed to be open to ground or closed.

My design is for the 8051 to supply the 5V for the LEDs.
Is this why the pins are acting opposite to what I expect?

richardscheff@gmail.com wrote:
> I set up my circuit exactly as you described. It still does not work. > I was hoping someone might have experienced this problem and know the > solution. All pins are high except for the two analog comparators. > > I was looking at the circuit sschematic with the LEDs. It looks like > the 8051 is acting as the ground for the LEDs and not the power supply. > Does that mean that pins are designed to be open to ground or closed. >
the port pins are outputs, you set them low or high. As wired if you make them low it will turn on the LED
> My design is for the 8051 to supply the 5V for the LEDs. > Is this why the pins are acting opposite to what I expect? >
yes rw
<richardscheff@gmail.com> wrote in message
news:1134443700.200259.92680@z14g2000cwz.googlegroups.com...
> I set up my circuit exactly as you described. It still does not work. > I was hoping someone might have experienced this problem and know the > solution. All pins are high except for the two analog comparators. > > I was looking at the circuit sschematic with the LEDs. It looks like > the 8051 is acting as the ground for the LEDs and not the power supply. > Does that mean that pins are designed to be open to ground or closed.
Sort of. Read below.
> My design is for the 8051 to supply the 5V for the LEDs. > Is this why the pins are acting opposite to what I expect?
Supplying 5V from a 8051 to a LED is not possible. A 8051 pin is actually an open-drain output with a weak pull-up current source. So the output can sink (flow to ground) few milliamps, enough to drive a led. But it can source (supply from VCC) only 50 micoamps which is not enough to drive a LED. You should really read a datasheet about this, where it is all described. Meindert

Meindert Sprang wrote:

> <richardscheff@gmail.com> wrote in message > news:1134443700.200259.92680@z14g2000cwz.googlegroups.com... > > I set up my circuit exactly as you described. It still does not work. > > I was hoping someone might have experienced this problem and know the > > solution. All pins are high except for the two analog comparators. > > > > I was looking at the circuit sschematic with the LEDs. It looks like > > the 8051 is acting as the ground for the LEDs and not the power supply. > > Does that mean that pins are designed to be open to ground or closed. > > Sort of. Read below. > > > My design is for the 8051 to supply the 5V for the LEDs. > > Is this why the pins are acting opposite to what I expect? > > Supplying 5V from a 8051 to a LED is not possible. A 8051 pin is actually an > open-drain output with a weak pull-up current source. So the output can sink > (flow to ground) few milliamps, enough to drive a led. But it can source > (supply from VCC) only 50 micoamps which is not enough to drive a LED. > > You should really read a datasheet about this, where it is all described. > > Meindert
He has a AT89C4051 it can sink 20ma per pin. The regular 8051 of course can not. The AT89C4051 can not source enough current to drive an LED. It is all in the data sheet.