Whoever is starting their journey through the embedded system comes across a confusion. C or embedded c? What should you learn? Are they same? What is the difference between them? And it’s a much-debated topic.

Embedded C

Embedded c is an extension over c language released by the C Standards committee that finds its application in embedded systems. They differ in only very small aspects and has lot of similarities than differences.C is a type of computer programming language, whereas Embedded C can be considered as a set of language extension for C. It is not necessary to have an operating system for embedded C but in the case of C, it requires an OS. They use the same syntax and semantics of standard C.

There are a lot of limitations in using C language for programming embedded systems as they have limited RAM and ROM while in PCs C language have access to the operating system, system memory and large amount of RAM and ROM. And therefore embedded c is written in such a way it utilizes the limited resources efficiently.

Difference between c and embedded c

High-level language such as C is preferred over assembly language because of the increasing complexity and fast-growing market of the embedded system. But many technical areas are found where all the functionality offered by the processors cannot be utilized by the applications written in C. Example: fixed-point operations, usage of different memory spaces, low level I/O operations, etc.

Fixed point operation

A fixed point operation is a common filtering algorithm used to process the analog signals in an embedded system. In order to achieve these embedded processors are often equipped with special hardware. But C language did not provide support for fixed-point arithmetic operations forcing the programmers to use assembly language. Many embedded processors are occupied with multiple memory banks and required data are grouped in different banks to achieve maximum performance and again, C language did not support the use of different memory spaces. But over time, c language got matured to support all of these features it missed and came up as an extension called embedded C.

Hardware Dependency

Embedded C is a hardware-dependent Programming Language. the embedded system programmers should have an understanding of the hardware architecture prior to writing programs. The programs are developed to manage external interface and internal architecture knowledge is required to configure the peripherals and features such as ADC, timer, communication, interrupt, etc. It is not necessary to consider the hardware while writing programs in c language.

Compiler Dependency

However, most of the Embedded C features are compiler dependent. And various chip manufacturers release their own compilers, packed with features to support their embedded processors. Compilers for Embedded C offers some special data types with different memory range, as efficient memory management is one of the importance of using Embedded C. There, we may even have datatype to store a single bit of data. Example, In XC8 compiler, used in MPLAB for PIC controllers we have data type named as ‘bit’ to store either 0 or 1. It uses only a single bit of memory. So we need not use bytes of memory to store just 0 or 1.

Embedded C is used for microcontrollers like TV, washing machines, etc. Whereas C finds applications in simple yet logical programs, OS-based software, etc. And therefore Compilers for C typically generate OS-dependent executable. Embedded C requires compilers to create files to be downloaded to the microcontrollers/microprocessors where it needs to run. And there may not be an operating system to support dynamic memory allocations.

Keywords in Embedded C

keywords are reserved words for doing specific tasks and which holds special meaning to the compiler. Along with standard c keywords, some compiler-specific keywords exist in embedded C. the keywords bit, sbit, sfr, are some of the keywords included in Keil CX51 Compiler.

Embedded C Data types

Datatypes are used to declare variables in the C program. C programming language includes the datatypes float, char, int, etc. Embedded C includes datatypes in addition to the datatypes in c and it includes bit, sbit, sfr,sfr16, etc.

Conclusion

As Embedded C is just an extension of C with some additional features to support embedded processors and their limited resources, one who is familiar with C will be comfortable to program using embedded C. Moreover, As C language is the basic foundation of most of the later languages like python, pearl, etc, By learning C you can learn most of the other languages comfortably.

Further Links:-

Spread the love, share this