Embedded Systems - 001. Programming Languages


An Embedded System is a combination of Hardware and Software designed to do a specific task. Bank ATMs are a good example of an embedded system. It has a robust hardware driven by a special software to authenticate an user & dispense money after validation & accounting.

 

What is a programming language?

A programming language is a human writable & readable script that is used to define a solution for a task, which otherwise would take tedious and redundant timely resource to do the achieve the same by humans. Programming language or simply a computer program is a set of instructions that are used to make a logic computer to make calculations to arrive at the desired results.

Personal Computers (PC) are largely used to do this, with multiple use-cases and can be a versatile device for solving complex problems. Example of a PC is a laptop, which can do word processing, web browsing, multimedia, etc, by loading different software programs on a common hardware (ie., the laptop) and is normally driven by complex and large piece of softwares. PC devices are normally expensive and can be an overkill to perform a tiny program such as reading a sensor data, or displaying a text, or any such meagre tasks.  

This is where a Microcontroller (uC) is used at certain use-cases where a small & specific task, that is repetitive, mundane for human to perform that particular task. Example, a banking token number annunciator, which only has to display & announce the token number of the next customer to be served by the bank staff.

However, both the computers (PC or uC / Microcontrollers) programs have certain of commonalities, which is more than just instructions. Both systems contain data, various memory addresses, peripheral devices on which the instructions work to perform the intended task. 

Programming languages:

  • Assembly
  • C and C++ (two of the oldest, powerful languages & still prevalent)
  • Java
  • Python
  • Rust

A programming language is meant to be human readable, otherwise it couldn’t be easy to tackle the challenging problem.

However, a machine is limited with respect to any human being and can only understand to simple signals. This is why the computers are designed to work on Boolean Logic, whether it is to resolve from a task as simple reading whether a signal is on or off, or to compute complex problems such as reading and writing complex multimedia document.

Both of it are achieved by Boolean logic systems. It is because the computing machines run on electricity, and electricity is mostly in an ‘on’ or ‘off’ state, which is represented in 1 for ‘on’ and 0 for ‘off’. Since electrical signal/power can be implemented in various levels, it is easier to represent them in 1’s and 0’s for ease of understand the underlying logic for everyone involved. This is the very reason why we say a computer is a Binary or Boolean Logic system.

Programming languages used in Embedded systems:

  • Assembly (platform / chip specific)
  • C and C++ (extensively used in embedded)
  • Java (originally created to solve the cross-platform issues)
  • Python (modern choice, especially with advanced AI & ML apps)
  • Rust (gaining popularity in recent times)

C and C++ programming languages both are extensively used in embedded system program coding as they were originally designed to replace the confusing Assembly language coding which were specific for every different manufacturer or platform. Since they are used for over half a century, they come with rich pre-written library of codes that can be implemented in newer programs, thereby reducing the need of repetition of same lines of codes. So, if your goal is to become an embedded system programmer, becoming an expert in these two languages is a must. 

C is known as a subset of C++, as C++ is actually an extension of the predecessor C programming language. C++ implements the Object Oriented Programming concept(also knowns as OOPs concept) where it is useful when the resultant computer program is going to result in a very large complex lines of codes (typically over a few thousand lines), and the maintenance of code becomes tedious with just good old C language. However, smaller programs such as simpler Microcontroller programs still are coded with C, but can also be implemented using C++.  

Assembly language is basically made out of Mnemonics that directly carry out an instruction that is more closely towards (chip) machine understandable than for humans. Usually, C, C++, Rust, Java or any other programming language codes are converted to the chip specific mnemonics before broken down to pure machine code.

Rust, Python, Micro Python, and Java  programming languages are also being used in embedded systems, however, C & C++ are the industry standard for embedded systems program code development and we are going to learn on that here.

The field of Embedded Systems has seen a great boom in the past few decades. This is because, the technology is becoming economical to adopt, and it also reduces the time & resources to elevate human experience thereby.

C programming language

Mastery in C programming is said to be enough to implement all embedded devices. C programming is a high-level programming language (meaning that is more definitive, less jargon, easy to be understood by humans). Assembly level coding is also used at certain times, to reduce complex C code & make the program smaller & robust.

The B programming language was created to complete these tasks with a very less number of lines code, but it did not have data types or structures. C was then created which implemented features missing in B. C then became the standard the programming language in the UNIX systems.

C was created in the early 70s by Dennis Ritchie as a high-level programming language in UNIX operating systems. At that time, the Assembly language was mainly used, assembly language required many lines of code to accomplish a simple task. If you are good at c programming you can learn any programming language easily. C programming involves functions, arrays, pointer, and data structure. Most of the embedded system devices are developed using the c programming language. If you are looking for c programming teaching institutes. you can search for best embedded system training institute in Google.

Python Programming Language:

Python is high level, the interpreted general-purpose programming language it is developed by Guido van Rossum first it was released in 1991.

Python is garbage collected and dynamically typed language. Python supports multi programming paradigms including object-oriented, procedural and functional programming as well. Python is frequently described as batteries included language because of its comprehensive standard library files. Python programming language is used in an embedded system as well, to design an embedded system like in IoT python programming is used.

No comments:

Post a Comment