8051 newbie

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.

Reply to
richardscheff
Loading thread data ...

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

Reply to
Ryan Weihl

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.

Reply to
richardscheff

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
Reply to
Ryan Weihl

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

Reply to
Ryan Weihl

found this in my bookmarks:

formatting link
re

Reply to
Ryan Weihl

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?

Reply to
richardscheff

the port pins are outputs, you set them low or high. As wired if you make them low it will turn on the LED

yes rw

Reply to
Ryan Weihl

Sort of. Read below.

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

Reply to
Meindert Sprang

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.

Reply to
Neil Kurzman

I realy don't care that much about driving an LED.

I just looked at the design to see if I missed anything.

The only thing I got to work for about 5 minutes is that one pin would either go high or low based on another pin.

It worked after I changed my capacitor from 10uF to 1uF. I got so exited that I tried to run part of my origanal program which is to generate a 40khz pulse.

The original problem happened. All pins are high except both analog pins. So I reloaded the working program, in hopes to prove that maybe my code is bad. The problem persists. All pins are high except the analog pins.

I have 5 chips to play with and three so far exhibit the same results. I can not imagine that they are all bad.

I'm left to believe that I can not use Keil as a reliable compiler/assembler. Or that my programmer is not working. But if it programs and reads a chip exactly as it was programmed, I can't imagine it being the problem. And if I try running a hex file I downloaded and it still does not work, it probably isn't Keil either.

The circuit is simply power, ground, capacitor connected to reset and

5V, external oscillator connected to pin5.

All that is left is to turn the chip around so that the notch is not pin 1.

Reply to
richardscheff

1> Kiel is a Very good product. The Demo Version is limited. 2> the Metalink assembler is free. 3>here is a link to someones working board
formatting link

The Basic setup

10 Gnd 20 Vcc with a .1uF ceramic cap to gnd. 1 Reset 10uF to Vcc and 10K to gnd 5 Ocs In IF you are using square wave oscillator with a TTL output. If you are using a Crystal it goes from 4 to 5 with a 22pf cap to gnd on each one.

4>

formatting link
is a good place for 8052 based information.

5> Are you sure your code is working? try to write 0 to a port, 100 NOPs write FF to the port, then jump back to 0. Or Google for a demo hex file.

Good luck.

PS the Notch IS pin 1 if the notch is to your left pin1 is the bottom left pin.

Reply to
Neil Kurzman

can you tell me the URL of your program. would like to try to run it here. rw

Reply to
Ryan Weihl

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.