Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ASSEMBLY OR C FOR 8051?

Status
Not open for further replies.

daddeeee

Junior Member level 2
Joined
Jun 15, 2008
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,411
8051 projects in assembly

which language should we master if programming 8051.assembly or c?
 

8051 inline assembly example

Its better to start with assembly first and then switch to C.
 

is assembly always faster than c?

assembly in 8051 is very simple and its good for learning this uc.
but assembly takes many time for any project. you cant division or multiple numbers easy.

C is very easy for programming. but 8051 C compilers are not powerful and you may have another problems in programming.

but i think C is easier and faster than assemblym.
 

8051 writing in assembler

I suggest Assembly...as it has instructions over which u can have control i mean to say is that u know the contents of all the registers after each step....well this might not necessarily be the case in C....as C uses many temporary variables...and consumes registers....

Moreover your compiler will generate a smaller Hex file if u use assembly....since C needs many Include files to be compiled too.....
This is useful when u have a programmer which has code restrictions....
 

    daddeeee

    Points: 2
    Helpful Answer Positive Rating
c compare assemble 8051

To program microcontrollers effectively you need to understand the hardware architecture. I think it is always better to do a few assembly language programs before switching to Embedded C. Even when using embedded c, sometimes it becomes necessary to use assembly. So it is advisable, to learn assembly first.
 

asm for microcontrollers

Choosing C for programming is a better idea than choosing asm. But, try to know assembly. C is time consuming, easy to program, easy to debug and edit and u can use the same code for different controllers of 8051 family. So, go with C
 

assembler code 8051 chinese

I completely agree that you must think low level and write high level. In other words, you should learn to read assembler so that you can write better high level code. My suggestion is to use a good C compiler, and to observe the assembler code that it generates in order to anticipate what the compiler can do for your code.
 

assembly and a in 8051

The 8051 architecture is not suited for high level languages such as C. They were designed for assembly language. However there are many C compilers for 8051 but the generated code is usually large and slow. Unlike the 8051, AVR microcontrollers were designed for C language and they are also easy to program in assembler. Anyway, it is highly recommended to know assembly language for a given device even you write your software in C only.
Obviously if you want to write complicated software for 8051 it's much better to use C compiler rather than assembler but it can consume much 8051 program memory or even can not fit in the memory.
 

assembly in c code c8051

I don't want to prevent you from using pure assembly programming with 8051, but I don't follow your thoughts, basically. It's outdated by rather effective compilers as Keil C51 and today's 8051 chips, that offer at lot of program memory, if needed by your application. In cases, where C code runs into processing speed limitations, I think, it's not always possible to find a much faster assembly coding. But there's some room typically, and it may be meaningful to utilize it for a few critical lines of code.
 

learn assembly for 8051

I hardly ever use assembly language now. I used assembly language when i used Z80 processor many years ago and 8051 some time later. Now i use C almost exclusively. I think 8051 family is somewhat obsolete. There are many better devices like AVR, ARM, MSP430 although 8051 is still being improved.
 

8051 c assembly inlining

My idea is to use assembly where timing becomes critical.

Mixing C and asm is much better option.

C consumes less devlopment time and more code space
while asm viceversa

Today most of the processors come with a lot of memory (either flash or eeprom) so you dont need to worry about space.

Whenever timing is critical use inline asm

Regards
Nandhu
 

efficient code microcontroller

Code:
I think 8051 family is somewhat obsolete.
I basically agree. But, there is e. g. Analog ADuC family (or a similar TI product), a processor with 24-Bit ADC. No mixed single chip compares to it in terms of analog resolution, I think. Analog now managed to design an ARM7 device with similar parameters, but it's still in a sample phase. During the last 6 or 7 years, you had to use the 8051 chip. I did a number of projects based on this chip family, using C programming of course, and none suffered from poor processing performance.
 

how to write a 8051 program

Try to stay away from writing in assembly. If you've already studied assembly for some other uC or uP (PC for example), you are versed in digital electronics, you should skip to C and never write in assembly in your life.
 

efficient c51

As already stated, assembly is useful to understand how things work, or when you need to calculate exact process timing. I rarely use it these days. Modern compilers are really quite efficient, even for 8051. Unless you like to make work for yourself, stick with C, probably 10x faster to develop, and a great deal more portable.
 

asm to c c51

I used assembler on 8051 for a few years before changing over to Keil C51. At first I thought it would generate poor code, but after doing a lot of comparing the assembler generated by the c compiler I came to the conclusion that in most cases it generate more efficient code than what I would have :) I used the Keil C51 for everything including interrupt code on many industrial size multi processor projects without any problems. But I do agree that for debugging it is very usefull to understand assembler. A few years ago I changed over to AVR micros and even though they are faster there are still some things that were more easily / better accomplished on an 8051FA
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top