EmbeddedRelated.com
Forums

Newbie assistance for Atmel at89c2051 project

Started by Davon Shire December 30, 2003
First let me say thanks to Chris, I appreciate the comments. I like
'to the point' answers with facts to back up opinions. I can then
decide for myself which is best. I appreciate everyone else's comments
too. I'm sorry for my wording of the question which seems to have
started off a little flame war, I'm not trolling.

I have found that SDCC still meets my needs for my project. I also now
have an idea where the Keil compiler could fit into future projects. I
use both commercial and open source software. I sometimes find the
open source tools to be very difficult for 'newbies' to use as if they
have any background it usually Microsoft and it's spoon fed
background.  But I can create howto's to get them started. This
sometimes leads to article in magazines which is not a bad thing :-)

My needs:

My impression of SDCC is that it's a slow moving project (I have a few
that I manage so I know the frustrations, see HCS below for an
idea). My needs are more cost and 'it works' rather than the highest
quality code. I want to attract DIY users who are interested in my
project with low cost (I've got lots of howtos to help with their lack
of experience). SDCC fits that bill nicely. My bigger worry was that
it produced bad code, like one of the older C2C pic compilers for
Linux.  I know it was free and I figured out ways around the problem
but I have very little extra time to fix major compiler bugs when I
need to design hardware, write software, maintain web pages and try to
manage projects (BTW, I do have help but could use more :-).

Thanks for everyone's help and Happy New Year.

-- 
Linux Home Automation         Neil Cherry        ncherry@comcast.net
http://home.comcast.net/~ncherry/               (Text only)
http://linuxha.sourceforge.net/                 (SourceForge)
http://hcs.sourceforge.net/                     (HCS II)
Davon Shire threw some tea leaves on the floor
 and this is what they wrote:

> Greetings everyone, > I have a specific application I want to put a atmel processor to. The > processor would be along the lines of a AT89C2051-24, ideally something > I can program easily say using their ISP system.
You can't program the AT89C2051 in system, however you can use a burner/dev circuit for in system programming. I have a GPL one I designed a few years ago on my web page. http://milkstone.d2.net.au/burn.html
> I have a proto board design I found on the net for said mcu and it > pretty well fits what I need for this. However. Since I have NO > experience in programming one of these things. I was curious if there is > a simulator that you'd recommend I could use to learn how to use this > beast before I launch into building the real thing and realize I can't > make it work. > I do have windows machines, but I prefer using my Freebsd boxes.
Then use SDCC, it will be perfect for your usage. I see that some have suggested Keil, however Keil seems to be MICROS~1 Windows centric ? If that's the case Keil won't run on your FreeBsd box, whereas SDCC will.
> Any > answer right now will be helpful on this. I'm doing this project for a > non-profit organization and I have zero budget save what I'm throwing in > which isn't much.
SDCC is definitely your answer then. It has a wide following, a great simulator and is nice and stable.
> A general idea of what I'm going to do with this. Is use it to > translate a 3x4 matrix keypad output into a serial ascii equiv. So a > computer can check the info in a database and respond with a command to > start a motor to open a garage door. The mcu will also determin if the > door is open or closed. > That's the general idea of what I'm doing with this. Any and all > assistance is greatly appreciated.
Fairly easy to do with SDCC, I'd say. A friend recently wrote a 2 line by 16 character LCD test routine using SDCC, and it worked fine, he had no difficulty doing it. -- Kind Regards from Terry My Desktop is powered by GNU/LinuX, Gentoo-1.4_rc2 New Homepage: http://milkstone.d2.net.au/ ** Linux Registration Number: 103931, http://counter.li.org **
Neil Cherry threw some tea leaves on the floor
 and this is what they wrote:

> On Wed, 31 Dec 2003 16:03:43 +0000, Chris Hills wrote: >> In article <UoBIb.114$T21.22782@news.uswest.net>, Davon Shire >><davon_x@shires.org> writes >>>Tilmann Reh wrote: >>>> >>>I ordered a 932 development board for $59.00+ tax/shipping It seems to >>>handle pretty much what I'll need and since it's already assymbled I >>>won't have to worry too much about getting all the parts. >> >>>I've got SDCC running on one of my servers, though I haven't quite >>>figured out how S51 works it is definitely going to take me some time to >>> get comfortable with all this. >> >> DO NOT use the SDCC compiler. the LPC kit should come with a Keil >> compiler. Although this has a 4K limit on it you will probably be able >> to compiler far more code than with the SDC compiler. >> >> The Keil is extremely good at optimising ad data overlaying. The SDC >> isn't > > Is there anything else wrong with the SDCC compiler? I intend on using > SDCC for some Open Source stuff and just want to be careful.
There isn't anything *wrong* with SDCC, it has it's advantages and disadvantages like anything else :) A blanket "DO NOT use the SDCC compiler" is definitely advice worth ignoring because in many situations SDCC is superior to commercial applications, and cost is one of them. The fact that Keil does not run under Linux/*Bsd is another. You have the source code with SDCC, and in some cases this is a huge benefit. SDCC will always be available, and for Free, how many people have been burned when closed source products are no longer available as a result of a takeover etc ? It's a complex issue, and I'm sure that products like Keil are fine, however it's different horses for courses and one product doesn't fit all. As I said in another post, a friend wrote some test code to power a 2x16 line LCD recently. He used SDCC and the At89C2051 and it worked fine, he had no problems. I have some screen pics of SDCC in action at :- http://milkstone.d2.net.au/embedded.html -- Kind Regards from Terry My Desktop is powered by GNU/LinuX, Gentoo-1.4_rc2 New Homepage: http://milkstone.d2.net.au/ ** Linux Registration Number: 103931, http://counter.li.org **
In article <orjec1-vq8.ln1@gronk.porter.net>, Terry
<tjporter@gronk.porter.net> writes
> >A blanket "DO NOT use the SDCC compiler" is definitely advice worth >ignoring because in many situations SDCC is superior to commercial >applications, and cost is one of them. >The fact that Keil does not run under Linux/*Bsd is another.
Any technical reasons?
>You have the source code with SDCC, and in some cases this is a huge >benefit.
Only if you are a compiler writer. Not the same thing as a programmer.
>SDCC will always be available, and for Free,
This is not guaranteed, neither are bug fixes.
> how many people have been >burned when closed source products are no longer available as a result >of a takeover etc ?
Likewise with free products. BTW any news on SCO "owning" Linux and C++?
>It's a complex issue, and I'm sure that products like Keil are fine,
Well professionals use them on safety critical things.
>however it's different horses for courses and one product doesn't fit >all.
Are there any *technical* reasons why SDCC is a better compiler? Free, open source and the ability to run on a particular OS have no bearing on how good a compiler is. Accuracy, optimisation, compactness of code, support for variants (there are over 500 different 8051's using about 30 different cores including those with 24 bit addressing, contiguous memory greater than 64K and maths co-processors. etc /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Chris Hills threw some tea leaves on the floor
 and this is what they wrote:

> In article <orjec1-vq8.ln1@gronk.porter.net>, Terry ><tjporter@gronk.porter.net> writes >> >>A blanket "DO NOT use the SDCC compiler" is definitely advice worth >>ignoring because in many situations SDCC is superior to commercial >>applications, and cost is one of them. >>The fact that Keil does not run under Linux/*Bsd is another. > > Any technical reasons?
Can you please be more specific ?
> >>You have the source code with SDCC, and in some cases this is a huge >>benefit. > > Only if you are a compiler writer. Not the same thing as a programmer.
How about if you use OSX and want to use SDCC ? The source is *not* just for compiler writers.
> >>SDCC will always be available, and for Free, > > This is not guaranteed, neither are bug fixes.
Nothing is guaranteed, except death and taxes.
> >> how many people have been >>burned when closed source products are no longer available as a result >>of a takeover etc ? > > Likewise with free products.
What kind of "free products" are you talking about ? I'm specifically referring to "Free" ie software licensed under the GPL.
> BTW any news on SCO "owning" Linux and > C++?
Yeah, the court in Utah has ordered SCO to produce the discovery information required by IBM in the current lawsuit. They had 30 days to produce *evidence* of their claims in detail, something they have failed to to so far. In about 2 weeks we will see if SCO can actually *prove* their claims that IBM put some IBM developed code in GNU/Linux as disallowed by the contract they have with SCO regarding their legacy UNIX source code. For those that don't know, the SCO lawsuit is with IBM, it has nothing to do with GNU/Linux. ... SCO extortion mode on ... Oh by the way Chris, I own all the Keil source code, I don't intend to prove it to anyone (because my code is secret), and if you don't want to be sued as a Keil end user, you had better pay me $800 right away. Or else. .... SCO extortion mode off ....
> >>It's a complex issue, and I'm sure that products like Keil are fine, > > Well professionals use them on safety critical things.
I'm sure they do. I'm sure that hobbyists use them to generate code for puppy dog door openers and led blinkers too. Perhaps while you're on this "safety critical" rant, you'd care to paste here where Keil state that their products are guaranteed for use in safety critical applications ? Nuclear reactor controllers perhaps? How about aircraft flight systems ? Now I have absolutely *nothing* against Keil, it's another proprietary product and I'm sure that Keil provide value commensurate to the cost, for it's users. However making Keil out to be something it's not, and then comparing SDCC to that thing that Keil is not, is just a little erroneous to my way of thinking. Remember the original poster of this thread said, "FreeBsd" and "no money". SDCC satisfies his criteria perfectly. The term "life critical was brought here by you.
> >>however it's different horses for courses and one product doesn't fit >>all. > > Are there any *technical* reasons why SDCC is a better compiler?
SDCC and Keil are quite different for some reasons that you may not be aware off, I have never claimed that SDCC is "better" than Keil, but we can look at one instance where SDCC has an interesting feature, and compare it to Keil if you like. Simulation. SDCC can run two or more instances of it's simulator on the same Linux box, with each instance communicating with the other via pipes and psuedo serial comms. Each instance can be monitored, and values altered etc, the serial comms can also be monitored to see that both simulated micros are doing what's required. Perhaps you could illustrate how Keil performs the same task on the same PC under Windows ?
> > Free, open source and the ability to run on a particular OS have no > bearing on how good a compiler is.
I beg to differ, as I believe that all these aspects are important.
> > Accuracy,
Pleas elaborate ?
> optimisation,
Opts used differ because requirements differ. Do you want smaller code, or faster code ? Do you want to simulate the code and have some idea what you're looking at ?
> compactness of code,
Relates to the opts used.
> support for variants
The OP said "AT89C2051" and SDCC works fine with this variant, I know I have code produced by SDDC running on one.
> (there > are over 500 different 8051's using about 30 different cores including > those with 24 bit addressing, contiguous memory greater than 64K and > maths co-processors. etc
We all know this Chris, the 8051 family has the most variation and the most diverse range of manufacturers of any microprocessor around, and that's why it's so popular. However the OP is only using one fairly standard micro the Atmel AT89C2051, and SDCC will produce C code for that no problems. SDCC fits the OPS stated requirements, namely zero cost and to run on his FreeBsd system. In the light of these requirements I believe that SDCC is the better choice. Had the OP said "Lots of money, Windows only" I would not be contributing to this thread. -- Kind Regards from Terry My Desktop is powered by GNU/LinuX, Gentoo-1.4_rc2 New Homepage: http://milkstone.d2.net.au/ ** Linux Registration Number: 103931, http://counter.li.org **
Davon Shire wrote:
> Greetings everyone, > I have a specific application I want to put a atmel processor to. The > processor would be along the lines of a AT89C2051-24, ideally something > I can program easily say using their ISP system. > I have a proto board design I found on the net for said mcu and it > pretty well fits what I need for this. However. Since I have NO > experience in programming one of these things. I was curious if there is > a simulator that you'd recommend I could use to learn how to use this > beast before I launch into building the real thing and realize I can't > make it work. > I do have windows machines, but I prefer using my Freebsd boxes. Any > answer right now will be helpful on this. I'm doing this project for a > non-profit organization and I have zero budget save what I'm throwing in > which isn't much. > A general idea of what I'm going to do with this. Is use it to > translate a 3x4 matrix keypad output into a serial ascii equiv. So a > computer can check the info in a database and respond with a command to > start a motor to open a garage door. The mcu will also determin if the > door is open or closed. > That's the general idea of what I'm doing with this. Any and all > assistance is greatly appreciated. > > Davon >
It's a new year let's put this one to rest and get some work done. Dear Terry and Chris. Thank you both for your time and diligence in this discussion. I have used the content of my first post to help point out a few things and maybe bring to focus what's really important. Chris you are an Engineer type. You have all your credentials and your whatever and that's great. Terry you have the heart of pit bull (meant in a good way) and the brains of dedicated developer for OSS. Both are greatly appreciated. You did some fine foot work asking back questions and giving answers but really. In the end it's not going to matter if Chris paid attention to my first post or not, here's why. I want to make this work in the worst/best way. I haven't got the board yet. But I'm dreaming code and taking stomach tablets waiting to get into the project and get it done. Chris your major failing was you said. 'Don't use SDCC' which is kind of like saying, "nevermind using the sidewalk. Get from point A - B using the bus." Your reasoning being really that the bus had more bells, whistles and a better map of the city. Even though I mentioned I have a nice pair of tennis shoes. (FreeBSD box) and wanted to use them. Terry, clearly you know more about the SDCC than I do, and you have made some excellent points as to why I could/would want to use it. I still haven't much of a clue how to make use of the simulator but I need to read more I'm sure. Facts that are now current in this project. 1. I bought for about $65.00 US a prebuilt LPC932 proto board from the www.8052.com site. It seems to cover pretty much everything I need. 2. this means I'm going to have the crippled Keil software, which I can use and will use if it's easier/quicker. 3. I'm going to need to learn to write code so I can take the pieces that's been pointed out to me and try and put them together. Hopefully in a dependable and functional way. 4. Optimization was really never a factor in this design. Because I Just want it to WORK. 5. I only picked the at89c2051 because I had found a schematic and pcb design I could use to put it together. I didn't see how I could program it though. So that was how I got this whole thing started to begin with. 6. I have no dedication to any platform save the ones I can cheaply aquire. I'd have used a basic stamp if it looked like a good cheap idea. 7. A Simulator is a must I feel if I'm going to have a chance to make this work. And a simulator that works in a way I can figure out is even better. The S51 simulator seems good but alot like gdb when it comes to using it. It took me about 2 weeks to really get a decent grasp on gdb. 8. I need to program this in C, simply because I know C the best and bit fiddling with ASM would melt my brain and increase the development time. 9. If/when this job is finished. I may well become interested in designing more with these chips. they seem incredibly well priced for hobbiests. I have day dreamed a dozen more uses for these chips to help friends and have fun with. 10. I very much appreciate the views and opinions of eveyone here and I hope in the future I may have a chance to contribute. Best wishes for a good new year for one and all. Davon -- --- I came.. I saw.. And I wondered. what am I doing here! (To reply via email please remove the _x from my email address.)

Davon Shire wrote:

> Facts that are now current in this project. > 1. I bought for about $65.00 US a prebuilt LPC932 proto board from the > www.8052.com site.
Do you have a link to where on 8052.com you found this board ??? Thanks
hamilton wrote:
> > > Davon Shire wrote: > >> Facts that are now current in this project. >> 1. I bought for about $65.00 US a prebuilt LPC932 proto board from >> the www.8052.com site. > > > Do you have a link to where on 8052.com you found this board ??? > > Thanks >
My Appologies, it was from http://www.keil.com/mcb900/ this is the board I purchased. I'd just stumbled there from the 8052.com site. Davon
In article <78lfc1-47g.ln1@gronk.porter.net>, Terry
<tjporter@gronk.porter.net> writes
>Chris Hills threw some tea leaves on the floor > and this is what they wrote: > >> BTW any news on SCO "owning" Linux and >> C++? > >For those that don't know, the SCO lawsuit is with IBM, it has nothing >to do with GNU/Linux.
They are actually claiming that the "own" parts of the Linux kernel (and all of C++ as well) They intend to charge royalties on all Linux (and C++ ) users... They must be pretty desperate to do this because as soon as they do identify the code I can see it taking about a month before the next release comes out without that code in. So it won't make any difference.
>... SCO extortion mode on ... >Oh by the way Chris, I own all the Keil source code, I don't intend to >prove it to anyone (because my code is secret), and if you don't want >to be sued as a Keil end user, you had better pay me $800 right away. >Or else. >.... SCO extortion mode off ....
The difference is that AFAIK SCO have identified certain areas that they believe are theirs. As it is open source this they will have to show that they developed the source first and that is it is the same stuff. It's not quite the same as the scenario above. The code is open. I think the "case" is that they did some stuff for IBM that IBM later released into the Gnu/Linux chain. However as you say it is all very flimsy. I think it is a last ditch attempt by SCO to stay afloat. AFAIK SCO is what used to be Caldera. Also how the hell they think they can justify owning C++ beats me. No wonder Californian lawyers are rich. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
In article <3ff591a5$1_1@omega.dimensional.com>, hamilton
<hamilton@deminsional.com> writes
> > >Davon Shire wrote: > >> Facts that are now current in this project. >> 1. I bought for about $65.00 US a prebuilt LPC932 proto board from the >> www.8052.com site. > >Do you have a link to where on 8052.com you found this board ??? > >Thanks
In US http://www.keil.com In Europe http://www.hitex.co.uk The board is the Keil MCB900 /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/