8051 newbie
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
8051 newbie

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System
Author Message
Guest






Posted: Mon Dec 12, 2005 5:15 pm    Post subject: 8051 newbie Reply with quote

This question was asked before.

Quote:
Hi,


Quote:
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) ?


Quote:
Any pointer is appreciated.


Quote:
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.
Back to top
Guest






Posted: Mon Dec 12, 2005 5:15 pm    Post subject: Re: 8051 newbie Reply with quote

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.
Back to top
Ryan Weihl
Guest





Posted: Mon Dec 12, 2005 5:15 pm    Post subject: Re: 8051 newbie Reply with quote

richardscheff@gmail.com wrote:
Quote:
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
Back to top
Ryan Weihl
Guest





Posted: Mon Dec 12, 2005 11:56 pm    Post subject: Re: 8051 newbie Reply with quote

richardscheff@gmail.com wrote:
Quote:
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
Back to top
Ryan Weihl
Guest





Posted: Tue Dec 13, 2005 12:01 am    Post subject: Re: 8051 newbie Reply with quote

Ryan Weihl wrote:
Quote:
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
Back to top
Ryan Weihl
Guest





Posted: Tue Dec 13, 2005 12:09 am    Post subject: Re: 8051 newbie Reply with quote

Ryan Weihl wrote:
Quote:
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
Back to top
Guest






Posted: Tue Dec 13, 2005 9:15 am    Post subject: Re: 8051 newbie Reply with quote

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?
Back to top
Ryan Weihl
Guest





Posted: Tue Dec 13, 2005 9:15 am    Post subject: Re: 8051 newbie Reply with quote

richardscheff@gmail.com wrote:
Quote:
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

Quote:
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
Back to top
Meindert Sprang
Guest





Posted: Tue Dec 13, 2005 9:15 am    Post subject: Re: 8051 newbie Reply with quote

<richardscheff@gmail.com> wrote in message
news:1134443700.200259.92680@z14g2000cwz.googlegroups.com...
Quote:
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.

Quote:
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
Back to top
Neil Kurzman
Guest





Posted: Wed Dec 14, 2005 9:15 am    Post subject: Re: 8051 newbie Reply with quote

Meindert Sprang wrote:

Quote:
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.
Back to top
Guest






Posted: Wed Dec 14, 2005 5:15 pm    Post subject: Re: 8051 newbie Reply with quote

Quote:
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.

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.
Back to top
Neil Kurzman
Guest





Posted: Thu Dec 15, 2005 9:15 am    Post subject: Re: 8051 newbie Reply with quote

richardscheff@gmail.com wrote:

Quote:
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.

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.

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
http://chaokhun.kmitl.ac.th/~kswichit/Proto2051_web/Proto2051.html

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> www.8052.com 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.
Back to top
Ryan Weihl
Guest





Posted: Thu Dec 15, 2005 5:15 pm    Post subject: Re: 8051 newbie Reply with quote

richardscheff@gmail.com wrote:
Quote:
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.

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.

can you tell me the URL of your program. would like to try

to run it here.
rw
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB