Author Topic: Is learning 8051 worthy nowdays.  (Read 23210 times)

0 Members and 1 Guest are viewing this topic.

Offline Spiro

  • Contributor
  • Posts: 34
  • Country: cs
Re: Is learning 8051 worthy nowdays.
« Reply #25 on: May 20, 2012, 01:52:22 pm »
This is nice software for learning 8051:
http://en.wikipedia.org/wiki/MCU_8051_IDE

 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8550
  • Country: us
    • SiliconValleyGarage
Re: Is learning 8051 worthy nowdays.
« Reply #26 on: May 20, 2012, 02:35:33 pm »
As free_electron already pointed out there is no cheap C compiler

depends on your definition of cheap. 1500$ gets you the keil or iar compiler. Chickenfeed for a company. But, it raises a bigger question : why use c at all ? I have never understood why everyone tries to force a language, that was made to run on a register based machine with lots of ram like the PDP, run on resource restricted machines like 8 and 16 bit microcomtrollers.
C is stack heavy... Pretty hard to make it run on a machine where you get 256 bytes of ram....



Quote
Because the code, data and external data is seperated the 8051 will need to execute a lot of instructions to move data from one memory to another.
what are you mumbling about ?
Modern 51 based chips use on board memory. No penalty for access. Actually execution has always been optimized with the 51 as long as you run from internal rom. Going through the emif may cost you an additional cycle here and there but that is because of address/ data mux to save pins.

The modern chips have gone from 4.. 8 clocks per cycle to 1 and 2 clocks per cycle. The muxing is gone since everything is on board.

I would NOT use a bare bones 51 like a 87c52 or anything in DIL for a new design. Move with one of the silabs 8051F series cpus.

But, you are right, 51 is slowly ( very slowly ) moved to the museum. Up till a few years ago there was no real contender.. The Cortex M3 core is the first real mass-scale vendorless processor core out there and it has a really good chance of becoming the new standard.

Traditional arm was too top-heavy. And very little standard chips were available since the arm was targeted at asic makers. But also there the compiler isn't exactly chicken feed in cost. You don't want to know what a single seat of ARM's RVDS costs.... Every year !
Iar and keil are cheaper then.

The nice thing about cores like 51 and m3 is that many manufacturers use them. This gives a large pond to fish in and once you know the core you can easily switch chips.
With pic and avr you are stuck to one source...
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27913
  • Country: nl
    • NCT Developments
Re: Is learning 8051 worthy nowdays.
« Reply #27 on: May 20, 2012, 03:26:07 pm »
As free_electron already pointed out there is no cheap C compiler

depends on your definition of cheap. 1500$ gets you the keil or iar compiler. Chickenfeed for a company. But, it raises a
$1500 is not chickenfeed for many small companies! Everybody uses C because it is portable. Some of the projects I've worked on use the same code on microcontrollers, SoCs and PCs. Why write, debug and maintain 3 different pieces of software which do the same?
Quote
Quote
Because the code, data and external data is seperated the 8051 will need to execute a lot of instructions to move data from one memory to another.
what are you mumbling about ?
You better read some information on how many hoops a 8051 must jump through to get a byte of data from a certain address. Its a real ugly kludge!
Quote
Traditional arm was too top-heavy. And very little standard chips were available since the arm was targeted at asic makers. But also there the compiler isn't exactly chicken feed in cost. You don't want to know what a single seat of ARM's RVDS costs.... Every year !
Nonsense. GCC (which is available for free without support) will do just fine for any ARM controller. Since compiler vendors specifically forbid to publish comparisons between other compilers I guess GCC will work just as fine as any other compiler. Most of the speed and code size differences are in the C libraries that come with the compiler but there are extremely lightweight C libraries available for free as well.
Quote
The nice thing about cores like 51 and m3 is that many manufacturers use them. This gives a large pond to fish in and once you know the core you can easily switch chips.
With pic and avr you are stuck to one source...
More nonsense. Every 8051 clone has manufacturor specific extensions, programming methods and peripherals. A lot of time getting used to a controller goes into learning the peripherals. The CPU core is almost insignificant compared to that because the compiler mostly deals with the CPU.
« Last Edit: May 20, 2012, 03:39:46 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8550
  • Country: us
    • SiliconValleyGarage
Re: Is learning 8051 worthy nowdays.
« Reply #28 on: May 20, 2012, 06:33:30 pm »
Everybody uses C because it is portable.
yeah, right .... As portable as any other language...
That is a myth. You will always have to tinker with the hal. There is no escaping that. And that is where all the hard stuff is ( for beginners)

Quote
Why write, debug and maintain 3 different pieces of software which do the same
because of the fact that something designed for one architecture will run differently on another.
This is the problem with modern programmers. Every thing is treated as a pile of sourcecode without binding to hardware. The perfect recepy for bloatware...

Quote
You better read some information on how many hoops a 8051 must jump through to get a byte of data from a certain address. Its a real ugly kludge!
Not more than any other cpu out there. Like i said a MODERN 8051 has all memory inside. No more need for xram operations. Besides if you are going to use c : you dont care either way ! The compiler creates the code for you. And on a modern implementation of the 51 core the instructions are still only one clocktick. So it doesnt matter at all for the programmer. The compiler figures out if it needs an xram or iram access.

Actually this partitioned memory is better than a flat system. Code cannot be overwritten by runaway stack or heap. No problems with code injection. Data memory can never be executed. This alone helps you in making more solid applications that are less susceptible to common programming mistakes.


Quote
Nonsense. GCC (which is available for free without support) will do just fine for any ARM
right. Its that little 'without support' clause.. If you are the kind of person that likes spending 90% of his time trying to pound the square peg that the great-crap-compiler is into the round hole of eclipse...or go look for info on forums where everybody starts yelling at you ' you are stupid if you don't know xyz' and where every discussion eventually ends up being about what is the best code editor ( emacs vs vi/vim ) and whether to use gnome or kde for your desktop.... Be my guest.
Meanwhile : i have work to do.. Call support. I understand that this is not always possible if you are a hobbyist , but, why not make your life simple and start with a nice prepaged one click system that will get you up and running effortless. It is pointless first spending a week trying to get the environment running and making youself comfortable with it..
Buy one of the iar or keil devkits for 99$. Comes with a ton of fully documented examples.

I like polished ide's with breakpoint, watches, tracing and all the bells and wistles. Its 2012... The time of debugging by using printf and scanf is so last millenium... I like guis. Command lines are for dinosaurs, but that is my opinion. If you want to do it differently , be my guest. No problem. But do not force everybody to do it that way. The keil environment is really nice.

The reason arduino is so popular is exactly that. Install and have fun. The same goes for tools like iar and keil. Install and go.
This is something the gcc/ eclipse crowd have not caught on to yet.. There everything is hard.
I want to blink an led with a microcontroller but i first have to become a specialist writing linker scripts , make files , struggle through all the command line options and compile my toolchain ? Ehhh.... Not fun !
Quote
More nonsense. Every 8051 clone has manufacturor specific extensions, programming methods and peripherals. A lot of time getting used to a controller goes into learning the peripherals
You are mixing peripherals with core.
The base 51 has a uart , two timers 4 io ports , an emif and an interrupt system. The uart and timers are identical, no matter what chip you take. so are the io ports that are base to the 51 core.
 The other peripheras are vendor dependent and those you have to learn, yes, but that is valid for all other cpu's as well. But, if you take a pic 16 and another pic 16 the io port does not behave necessarily the same. In an 8051 the io ports all behave the same irregardless of vendor. Portb will always be portb. In a pic ? Some have pins modified to be open collector only , while in others they all of a sudden are push pull by default.
« Last Edit: May 20, 2012, 06:36:41 pm by free_electron »
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline jerry507

  • Regular Contributor
  • *
  • Posts: 247
Re: Is learning 8051 worthy nowdays.
« Reply #29 on: May 21, 2012, 05:09:23 am »
Quote
Meanwhile : i have work to do.. Call support. I understand that this is not always possible if you are a hobbyist , but, why not make your life simple and start with a nice prepaged one click system that will get you up and running effortless. It is pointless first spending a week trying to get the environment running and making youself comfortable with it..
Buy one of the iar or keil devkits for 99$. Comes with a ton of fully documented examples.

Several posts ago you complain about everyone wanting to do C and now you're raving about Keil. Sure, it's my favorite compiler too but my company won't shell out for it. We use the free crap. The tough problems aren't how to use the environment, it's how to use the chip. And Keil won't help you figure out why you're drawing 1mA instead of the datasheets quoted 300uA value. Call the vendor for that. Whooptie doo.

I don't see the huge utility in having some built in uarts and timers. Those peripherals are so easy to configure on ANY micro that they don't need standardization. Btw, you listed 9 bit uarts and HW div/mult. Many micros integrated one or both many many years ago. The 18 series from Microchip has HW mult and some other series have div as well. I can't remember the last time I saw a micro without 9 bit uart. Welcome to 2012.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8550
  • Country: us
    • SiliconValleyGarage
Re: Is learning 8051 worthy nowdays.
« Reply #30 on: May 21, 2012, 06:13:14 am »
You are pulling things out of context. C is meant for register based machines with lots of stack and heap. 8051 and many other microcontrollers are not such machines.
If you do want to go that route anyway : get a real development tool made for the machine architecture and not some generic compiler with a bit of a backend for the cpu. Gcc was never intended for small machines. Use sdcc if you must.

You are also pulling the other comments out of context.. The 8051 core has a uart , 4 io ports and some other stuff as standard. If you look at other microcontrollers from the same era : none have hardware div/ mult. At the time this set it well apart from the competition.
Anyway , the context here is : if you know this base 51 core you can use any chip from any vendor that employs this core. All you need to learn are the new bits , and those are a matter of configuring registers.

As for the 9 bit uart : this is very handy to make distributed systems. Instant , without software overhead.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline jerry507

  • Regular Contributor
  • *
  • Posts: 247
Re: Is learning 8051 worthy nowdays.
« Reply #31 on: May 22, 2012, 12:33:42 am »
I wasn't trying to pull things out of context, just trying to get MORE context. If the Keil compiler (or similar options) are available for a reasonable sized project, what is the advantage to using ASM keeping in mind the state of modern projects?

I understand where you're coming from with the div/mult now, my point is that these features have replicated down to nearly everything now. Not to tarnish the past of the 8051 (it did become a huge success for a reason after all).

I found it funny that I read today ARM has started an effort to standardize many of the peripherals on their cores in a similar fashion. My point is that SIMPLE peripherals such as IO, uarts and timers are generally not complicated enough to the point where just knowing the registers is really a time saver. On a modern processor you need help with DMA, USB, ethernet and power management, not timers.

From my experience, I've found that having a common interface (naturally well documented as well) would be less important than having common featuresets between ARM processors. I ran into a situation recently where I found that TI Stellaris processors have a systick timer module, but it isn't capable of waking the processor from sleep modes unlike newer Freescale processors. Whether this is a difference between M3 and M4 I don't know, but it made me with I had went with a Kinetis part. That annoyed the hell out of me, it's buried in the weeds.
 

Offline drewtronics

  • Contributor
  • Posts: 12
  • Country: us
Re: Is learning 8051 worthy nowdays.
« Reply #32 on: May 24, 2012, 06:07:50 pm »
Not going to comment on any philosophical arguments....

Cypress has some really cool, really fast 8051 chips that you can use for very fast data grabbing over USB.  The Saleae logic analyzers (the 8 bit ones) use the cypress 8501 ICs. I'd wanted to play around with them but never got the time to really dig into them.
 

Offline targ2002

  • Contributor
  • Posts: 11
  • Country: gb
Re: Is learning 8051 worthy nowdays.
« Reply #33 on: May 24, 2012, 07:54:15 pm »
I learned quite a bit about these while I was uni, but didn't think I would encounter them when I started work.

Now I have to maintain some software for this device
 

Offline ColinB

  • Contributor
  • Posts: 26
Re: Is learning 8051 worthy nowdays.
« Reply #34 on: May 29, 2012, 08:07:57 pm »
Using 8051 for anything serious has really been painful for me.  The stack is effectively limited to about 200 bytes (256 max internal data memory).  It's really ugly when you need over 64 KB of code space, then you have nasty banking of code space.  The 8051 is really bad for C programming because there are 3 or 4 memory spaces, so pointers actually need 3 bytes to store, and special switch-case code generated by the compiler to manipulate pointers -- the expensive proprietary compilers will optimize these things better, and in SDCC (the only free 8051 compiler) you can explicitly declare the memory space to which a pointer belongs, but all these things are expensive and ugly.

I would say that MSP430 and AVR are a hundred times better than 8051 if you want to use free tools.  You can use gcc on them, which means C, C++, and good code optimization and compiler warning features, not to mention it implements modern C and C++ standards (C99, C++11).  For the MCS-51 (8051) you are stuck with SDCC as the free compiler.  It is not C99 compliant, has no C++ support, and is not fun to deal with compared to gcc.  I can't blame SDCC too much for the bloated machine code it produces for the 8051, since 8051 has such a lousy architecture and instruction set for modern programming.

You can play with 8051 and learn it if you want, but you are surely a masochist if you do... I would choose AVR, MSP430, or ARM Cortex-M3/M0 first ... I can't speak for PIC, I have no experience with them, since I have tried to avoid using PIC due to lack of good free tools.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8550
  • Country: us
    • SiliconValleyGarage
Re: Is learning 8051 worthy nowdays.
« Reply #35 on: May 29, 2012, 08:20:17 pm »
like i said, 8051 predates widespread c ...
and 'c is not the end-all of programming either. especially not for microcontrollers.

but today, yes go for a mpore modern controller. like a Cortex based machine. Lots of vendors. lots of tools
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4306
  • Country: us
Re: Is learning 8051 worthy nowdays.
« Reply #36 on: May 29, 2012, 11:04:41 pm »
Learning 8051 would not be my first choice of a device to use in the modern world.  But that's a long way from "not worthy of learning."  If nothing else, it provides an interesting perspective for understanding the development of microcontrollers SINCE then.  (And computer languages as well.  A key difference might be that older microcontrollers were designed to be programmed in assembler.)

It's not like there aren't plenty of other archaic architectures floating around.  And MANY, MANY, chips.  The 8bit PICs, all those 8051 companies, and a sizable number of things that are essentially Z80s (zillog and renesas.)  If your education stops with microcontrollers that work well with a C compiler, you're missing a lot.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf