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.

C or assembly programming , which one is powerfull

Status
Not open for further replies.

1230

Member level 3
Joined
Jun 18, 2002
Messages
62
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
355
hi friend

i want know for microcontroller (PIC and atmel) projects ,which one is more powerfull ,C or assembly. specially for led scrolling display system.
thanks
 

assembly should be more powerful than any language but I think it is more difficult to master so you may actually create better code in C because it it much easier to use.

Alex
 
  • Like
Reactions: 1230 and MRAMA

    MRAMA

    Points: 2
    Helpful Answer Positive Rating

    1230

    Points: 2
    Helpful Answer Positive Rating
for any controller both C and assembly are equally good. there is nothing caled powerful language..

C is easy to understand and maintain the code, but C occupies more memory space compared to assembly program. they are also slow compared to assembly..

where as assembly is difficult to write as it is dependent on the architecture and the assembly instructions are are different for PIC and 8051. so you should know the architecture and assembly instruction of the family of the controller, so it is not a first choice for programmers. So C is always preferred by most of the people..

you use the language which you are good at............

this code for the above project can be written in both C or assembly.....
 
C is easy to understand and maintain the code, but C occupies more memory space compared to assembly program. they are also slow compared to assembly..

this is exactly what we mean by more powerful, you can create in assembly more efficient code that executes faster.

Alex
 
  • Like
Reactions: 1230

    1230

    Points: 2
    Helpful Answer Positive Rating
One of the great advantages of C is that your code is portable from MCU to MCU, that is you can use the same files for different MCUs, except the low level ones (ports IO, AD setting and interface, etc). So if you read a button from a port, then yes this part should be written differently for each controller even in C. But the part that debounces and processes the button value should be kept the same. This means less development time than assembly, where you should write all files from the beggining. So from that point of view C is more powerful.
 
Last edited:
thanks to all for giving me your valuable suggestions & making me to understand more perfectly. :)
 

I would say C is more powerful in the sense that it is easier to code in C. Most importantly it takes much less time to write a program in C than in assembly. The compiler may have a lot of functions which would further reduce development time and effort, such as LCD routines, delay routines, ADC routines, etc. These must all be written and configured manually in assembly. While these functions may not be as efficient as assembly from the perspective of code space usage and execution time, they reduce development time and effort and thus this is why I would say C is more "powerful".

Hope this helps.
Tahmid.
 
  • Like
Reactions: 1230

    1230

    Points: 2
    Helpful Answer Positive Rating
ya of-course tahmid ...
Thanks.
 

I think C is more powerful because, depending on the mcu and compiler of course, you can always view the Disassembly and see how your compiler writes assembly based on your C code. You can then analyze it and figure out more efficient/faster ways to code it in assembly if you program space is getting low or if you have time-critical processes.
 

PIC is advance but a bit expensive. Here in our country it is 3times more costly than atmel. so if you only have to glow the led's i will recommend atmel if you have to use ADC's, SPI or EEOROM then you should prefer PIC.
The hex file created by C language code is larger than that of assembly but assembly is a bit difficult language so mostly C language is used.
 

It easier to code in c. But the knowledge about mcu will be limited.assembly is the best language which stands near mcu.c is more user freindly. U can try built in libraries for pic and 8051 in microelectronicas microc and 8051 pro.try it best wishes!!!!!
 

C is very high level and assembly is based on machine codes (opcodes)... when a person writes a code in C language it will get converted in assembly language using compiler assembler configuration ....so in case of high level languages the interpreter ( compiler ) palys major role for how the code get translated in to assembly laanguge....if one is writting the code in assembly enjoy all the fexeiblity in the coding than the high level language like C.....so in my view assembly language is more powerful than C language
 

C is the best choice, no doubt about that... But in certain situation, we may be forced to use at least a few lines of assembly ....
For example,
if we need to implement a small task switching (multitasking) in a microcontroller, I don't think we could do it with C alone, because we need to backup the CPU registers, need to divide the stack etc etc. instead we could do it with C + assembly mixing or pure assembly....
 

C is the best choice, no doubt about that... But in certain situation, we may be forced to use at least a few lines of assembly ....

I'd like to give another example of this. Just the other day, I was trying to use the internal PLL mechanism of the dsPIC33 with the internal fast RC, so that I could get the dsPIC to work at around 80MHz from the internal RC oscillator. For this, first I had to start up with the internal oscillator, then set up the PLL, follow an unlock sequence and then switch to the PLL mode. Here, when I tried doing it in just C, there were problems. When I did it in assembly, everything was fine. This is because, the unlock sequence and switching required the steps to be carried out in immediate successive steps. When using C, there was no guarantee that when I write two consecutive lines, they will be followed with no other delay or instruction carried out. But in assembly, I can control each and every step.

Hope this helps.
Tahmid.
 
for beginners c language is the best to implement any system.

Easy to write and analysis.
 

C is always easier to learn and implement.
But to learn and extract the maximum benifits one should atleast have the basic idea of assembly language od the controller in use
 

C is very easy and a high level programming language
and every time there is a new level of programming language like ladder language witch is much easy
I start with assembly for AVR . and after one year I start learning CodeVisionAVR and after five years I still using the same compiler with no problems.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top