Why to move from ASM to C

ASM language is a low level programming language. It takes tons of time to develop embedded programs. Now even 8 bit microcontrollers arent as smal as they were earlier. The program memories are climbing to megabyte(s). Program structure becoming more complicated because of bigger functionality demand. This is why it is better to use higher level programming languages like C.

By using C language you are not overwhelmed by details. You don’t have always to think about hardware logic to be able to program its restricted tasks. It is better to give this work to C compiler which helps you to avoid bugs in silicon level.

Another C language benefit against ASM language is portability. Lets say you work on one embedded system architecture and decide to move to other maybe more advanced. If your previous program were written in ASM language, then you will need to rewrite (modify) this code from scratch. Using C language you are able tu run program on different microcontroller without significant modifications. This also reduces the costs of your project upgrade.

Continuing the thought it is good to mention, that using C it is easy to save specific hardware routines to libraries which are convenient to use in other projects. Using C library functions and headers ensures that application source can be recompiled for different MCU targets.

And the most important thing in using higher level programming language is that you can focus on algorithm design and spend less time on implementing. C is a high level language. It enables to write embedded programs more quickly and easy. One C line can stand for several ASM lines.

ASM language is used in critical parts of programs, but again C compilers are improving and sometimes program written in C may be more efficient then written in ASM. It depends more on programmer than a programming language.

One Comment:

  1. I am in process of researching around assemblers about to start designing a new language.
    In my opinion, major disadvantage of high-level languages (HLL) is obscure code generation.
    Since HLL are not targeted for (not constrained with) any particular platform, code generation is left up to compiler vendor (developer). It is OK in case when hardware constraints on the target platform are pretty much loose and system (product) built with it does not violate the requirements. However, when tough hardware constraints come across tight system requirements, engineers need more control on the produced code.
    Assemblers vs HLL

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.