Embedded Systems are a combination of hardware and software. That is, a piece of hardware that can be made to execute a specific task in a way we want, through some code or program (software). For example, a micro controller with a hardware (Integrated Circuit) can be used to control or monitor a motor or a pump (device), using software that defines how the device should perform.

The hardware part has both control and sensing mechanisms. The sensors watch the performance of the device and generate data in real time. The software reads and analyses the data, chooses what to do next, and sends specific control instructions to the device.

Microprocessors & Micro controllers

Embedded systems are divided into a microprocessor (MP) and a micro controller (MC). The name microprocessor and micro controller are used interchangeably since they share common features and have minor differences.

A microprocessor, such as Intel’s’ i3 or i5, consists of just a CPU. It requires external memory (RAM and ROM) and ports (USB, serial) for its operation. A micro controller, on the other hand, has literally everything – a CPU, RAM, ROM, I/O port, etc., in a single device. A microprocessor is used for large, complex, and multitasking operations such as those done on a PC or a large computer. On the other hand, a micro controller is used for small and specific tasks such as a printer, a keyboard, mouse, etc. Each of these devices has a specific utility that is pre-defined and manageable.

Why Do We Need Embedded Systems?

Everything we use, from satellites to wrist watches, is designed using embedded systems. It helps to increase the performance, efficiency, accuracy and several other factors of a device or a product. Embedded systems in devices remove the need for manual intervention, enhance the features of the device, reduce complexity, and thereby increase productivity.

Embedded Hardware

Embedded products are designed using a micro controller or microprocessor based ICs’ (Integrated Circuit) based on a specific application. In general ICs are made up of digital circuits such as logic gates and combination circuits. Most ICs require a digital power supply of 5 V for their operation. In the recent past, ICs’ that operate on 3.3 V or lower have become available. These are used to create handheld devices such as cell phones and remote controllers.

Embedded Software or Programming

A micro controller or microprocessor by itself has no utility unless it is suitably programmed. So what is programming? A program is a set of instructions that says what the controller should do at any point of time.

Initially, MC’s were programmed using switches, which was complicated. Later on, this was replaced by a low-level language called Assembly. Each MC had its own Assembly code for writing instructions or software. Assembly language has the advantage of using full resources of the controller with accurate timing sequences to the order of milliseconds or microseconds. The drawback of assembly language is that it is difficult to learn, write codes, and debug. This drawback of the Assembly language is overcome with C language.

Embedded C

C is a high-level language used to create software applications. The advantage of C is that it is simple yet powerful enough to create complex applications. The drawback of C, for an embedded engineer, is that it does not give the programmer the authority to select or use some of the resources, such as memory in an MC. To some extent, it also has a shortcoming in creating accurate timing signals. But C does give you the flexibility to embed assembly code within the C code. So where you need to access resources, you can insert suitable assembly code.

The merits of C language, though, overshadow its demerits. It is the preferred and recommended language for programming of MCs. The C language code, after thorough testing and debugging, can be compiled and converted to the native code of the MC. Depending upon the application, the native code is small and is burnt onto a ROM inside the MC. More about this below.

There is not much difference between embedded C and the regular C language in terms of syntax or logic of programming. Embedded C program is hardware specific, which is the not the case with general C programming. Embedded C code is specific to the MC. An embedded C code developed for, say the 8051, will not work on any other controller. Hence, the programmer should be aware of resources available in the controller he is working on.

The Ecosystem

An embedded hardware is a digital circuit that uses binary data. It cannot understand C or assembly language code. Hence, software written using assembly language or C is converted to digital format using an assembler or a compiler respectively. There are several testing tools like debuggers and simulators available for coding, testing and debugging of embedded devices.

When completed, the instructions are stored in hexadecimal format, also called hex. The hex format uses 16 as a base instead of the decimal base 10 that humans use. The reason hex is used in MC is that it is easier and more accurate to convert hexadecimal to binary code. The hex code, as we said before, consists of base 16 represented by 0 to 9, A, B, C, D, E, and F.

The process of loading a hex file into the MC is called burning, flashing or programming of the MC. There is a special hardware called Programmer, which is used for programming of MC.

After programming, when provided with power supply and suitable I/O devices, the embedded hardware can be used for regular operations.

Data Handling

MCs are available in 4, 8, 16, and 32-bit configurations. The numbers represent the width of the internal register as well as the internal and external I/O buses. In most cases, the width of the register and the I/O buses will be the same. The numbers also represent the quantum of data that can be stored and processed by the MC. A 16-bit MC can manipulate 255 data elements at any time.

The 4-bit MC has very limited functionality and is used mostly for digital clocks and timers. The Intel 8051 is a 8-bit MC and is rumored to monopolies nearly 50% of the MC market. A 32-bit controller operates at very high speeds and efficiency. An MC is chosen based on the requirement, Where an 8-bit MC can suffice, it will be foolish to use a 32-bit MC as the costs of the end product will shoot up.

Memory

A micro controller has multiple memory types such as RAM, ROM, EEPROM etc. The converted binary code is usually stored in the Read Only Memory (ROM). Once burnt, ROM does not need the power to store the data, and hence, will not lose the instructions even after removal of the power supply. At the same time, the ROM data cannot be changed once burnt. In a way, the data and code inside a ROM can be considered static. Random Access Memory (RAM) is used for temporary storage of data during code execution and will lose data in the absence of power.

Like the ROM, the EEPROM also does not lose the data when there is no power. Unlike the ROM, the data can be changed any number of times. EEPROM is used to store important, but dynamic data such as passwords and backup needed even when there is no power.

I/O Busses and devices

Input and Output (I/O) busses are used for transfer of data. The internal I/O bus is used for data movement between the process and memory. The external I/O bus is for interface with the external world. It is used to input information into the MC and accept data and instructions that the MC provides. Sensors, displays, keyboards are external devices.

Communication Protocol

The movement of data and instructions has to be done in such a way that is it understood by the MC, and all the devices it interacts with. This is managed by what is called ‘communication protocol‘. This protocol is used for communication between two or more devices. USB, IIC, SPI, and RS232C are the some of the communication protocol employed in micro controllers for communication.

About Sosaley

Sosaley Technologies is a growing company leading in the development of firmware, embedded systems, and other automation hardware and software. Sosaley is led by industry veterans who have pioneered software development in India, and have worked with companies such as Juniper Networks, Citibank, and many other Fortune 500 companies.

Sosaley is working with leading companies in India and elsewhere in multiple domains. Click here to read more about Sosaley Technologies. Read more about embedded systems here.