EmbeddedRelated.com
Forums

Using C to program the 8051 family

Started by Aliasger January 1, 2004
Hi,

I've been developing some 8051 based projects and the programming is
getting a bit taxing in assembly language.

I'm a bit familiar with C and was thinking of using that to program
the uC.

Does anyone have any good websites where I can find some in depth
information on starting off programming the 8051 in C?

Thanks a lot.

- Al
>I've been developing some 8051 based projects and the programming is >getting a bit taxing in assembly language. > >I'm a bit familiar with C and was thinking of using that to program >the uC. > >Does anyone have any good websites where I can find some in depth >information on starting off programming the 8051 in C? > >Thanks a lot. > >- Al >
www.keil.com is a good starting place. They have an obvious interest in selling you a compiler, but there are lots of technical notes and example code. It's a very useful site.
In article <20040101133352.01759.00001198@mb-m20.aol.com>, Ppelectron wrote:

>>Does anyone have any good websites where I can find some in depth >>information on starting off programming the 8051 in C? > > www.keil.com is a good starting place. They have an obvious > interest in selling you a compiler, but there are lots of > technical notes and example code. It's a very useful site.
If you're interested in a free compiler, you should take a look at <http://sdcc.sourceforge.net/>. Even if you're not interested in the compiler, the links page has a lot of good things. -- Grant Edwards grante Yow! We are now enjoying at total mutual interaction in visi.com an imaginary hot tub...
In article <d0817e19.0401011005.34b96f4f@posting.google.com>, Aliasger
<aliasger_18@hotmail.com> writes
>Hi, > >I've been developing some 8051 based projects and the programming is >getting a bit taxing in assembly language. >I'm a bit familiar with C and was thinking of using that to program >the uC. >Does anyone have any good websites where I can find some in depth >information on starting off programming the 8051 in C? >Thanks a lot. >- Al
It depends on who's 51 you are using and what sort of applications you do. http://quest.phaedsys.org C51 Primer, C traps and pitfalls, embedded debugging and other papers papers. www.8052.com is also very good. Compilers:- www.keil.com www.iar.com www.tasking.com Depending on your the Mcu you are using the manufacturers web site is a good place to start. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
On 1 Jan 2004 10:05:53 -0800, Aliasger wrote:
> Does anyone have any good websites where I can find some in depth > information on starting off programming the 8051 in C?
Start at http://www.8052.com/ do a little searching, also google is good at searches. You might try different variations with 8051,8052, 8031, howto and C compiler. Use the advanced search to limit the information. Also do a goole seach on the newsgroup (and probably a few others) as it may turn up a few intersting links. http://www.howstuffworks.com/c.htm http://hcs.sourceforge.net/howto.html The above maybe a little helpful. The grey'd out links on the HCS page are things I'm working on. The links work but the articles are a work in progress so pardon the grammer and spelling, I'm no where near done. I tend to rip, tear and throw free thoughts on a page. I wouldn't mind either emailing me or a reply here to anything you might find that is useful. -- 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)
Aliasger wrote:
> > I've been developing some 8051 based projects and the programming > is getting a bit taxing in assembly language. > > I'm a bit familiar with C and was thinking of using that to > program the uC. > > Does anyone have any good websites where I can find some in depth > information on starting off programming the 8051 in C?
If you had followed this newsgroup for even a few days you would have found a healthy discussions of the pros and cons, costs and limitations of the SDCC and Keil compilers and availability thereof. -- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!
Hi, I would think again, switching to another language won't make your problems
dissapear you just get some new ones. If C is the right chioce for your project
then the 8051 is allmost certainly not the right processor.
"CBarn24050" <cbarn24050@aol.com> wrote in message
news:20040101200157.15398.00002261@mb-m04.aol.com...
> Hi, I would think again, switching to another language won't make your
problems
> dissapear you just get some new ones. If C is the right chioce for your
project
> then the 8051 is allmost certainly not the right processor.
I disagree. Taking the second point first: C is absolutely fine for an 8051. Ideal, even. The first point has an element of truth. If the problems are not related to code management (e.g. it's the wrong platform for the job regardless of language), then you're right - C won't help. But often the "problems" with large assembler projects come down to an underlying lack of structure or organisation. Mastering C (which can take a while - I'd agree it's certainly not an instant magic bullet for a newcomer) *should* help with gaining a means of adopting good structuring - i.e. good, modern design practice. OTOH, I've seen some right pigs ears written in C - for any platform. To the OP: I frequently use C as a means of designing code, and then either hand- or machine-compile from there. The discipline that modern object-oriented C encourages, e.g. active control of scope of variables, is hugely helpful even in assembler - even if assembler doesn't demand it. HTH, Steve http://www.fivetrees.com
In article <20040101200157.15398.00002261@mb-m04.aol.com>, CBarn24050 wrote:

> Hi, I would think again, switching to another language won't > make your problems dissapear you just get some new ones. If C > is the right chioce for your project then the 8051 is allmost > certainly not the right processor.
Why do you say that? A _lot_ of people (including some I know) have done an awful lot of 8051 projects in C. They seem quite happy with the results. -- Grant Edwards grante Yow! If I felt any more at SOPHISTICATED I would DIE visi.com of EMBARRASSMENT!

"Aliasger" <aliasger_18@hotmail.com> wrote in message
news:d0817e19.0401011005.34b96f4f@posting.google.com...
> Hi, > > I've been developing some 8051 based projects and the programming is > getting a bit taxing in assembly language. > > I'm a bit familiar with C and was thinking of using that to program > the uC. > > Does anyone have any good websites where I can find some in depth > information on starting off programming the 8051 in C? > > Thanks a lot. > > - Al
use Google and search for "final word on the 8051", you will find an online pdf file that should be quite helpful. (it assumes you are using the Keil compiler but is useful even if you use another one) Mark