Question: Which features of c-programming may be specifically useful in embedded system? How?

Mumbai University > Electronics Engineering > Sem 6 > Embedded System and RTOS

mumbai university esr • 201 views
modified 8 months ago  • written 9 months ago by gravatar for Manali Ghorpade Manali Ghorpade20
  • C is a well-structured well defined and standardized general purpose programming language with extensive bit manipulation support.
    • C offers a combination of features of high level language and assembly and helps in hardware access programming.
    • C is simpler to learn, understand, program and debug.
    • Compared to assembly language, C code written is more reliable and scalable, more portable between different platforms.
    • Unlike assembly, C has advantage of processor-independence and is not specific to any particular microprocessor/microcontroller or any system. This makes it convenient for a user to develop programs that can run on most of the systems.
    • As C combines functionality of assembly language and features of high level languages, C is treated as a ‘middle-level computer language’ or ‘high level assembly language’.
    • It supports access to I/O and provides ease of management of large embedded projects.

Following are the various features of C language that can be used in embedded firmware development.

  • C facilitates data type declaration: Data type declaration provide programming ease. Data types like int, unsigned int, short, long etc. can be declared. This helps in setting a permissible range, for e.g. a positive valued variable can be declared as unsigned int.
  • Also it helps in determining how much memory a variable will consume if it is set to a particular type.
  • C facilities type checking: Type checking makes program less prone to errors. For e.g. declaring a variable as char doesn’t permit division and multiplication operation on that variable.
  • C facilitates the use of control structure: Loops and decision making statements can be easily implemented using the keywords like while, for, if, else etc. This provides a clear understandable program flow.
  • C provides a short program development lifecycle:

a. C allows us to define function which helps in reusing code.

b. Library functions like sqrt (), floor (), ceil (), etc defined in C; saves development time as implementation of such functions is not required.

c. C helps in having top-down design approach where the main program is divided into modules, sub-modules and finally functions.

d. C helps in defining device drivers which can be used to activate multiple devices present in the controller or processor by passing the correct device ID, required parameters, etc.

written 8 months ago by gravatar for Manali Ghorpade Manali Ghorpade20
Please log in to add an answer.