CAN PYTHON REPLACE C/C++ FOR PROGRAMMING THE BAREBONE HARDWARE?

Processor or barebone hardware can only understand ‘ON’ or ‘OFF’, that is only 0 or 1. So to make them work for us we need to talk to them in their language. Processors read the user inputs at several strings of 0’s and 1’s. These long strings of 0’s and 1’s are called ‘Machine Language’ where every character is represented in ASCII values such as my name ‘Mainak’ can be represented as ‘01001101 01100001 01101001 01101110 01100001 01101011’. So you can understand that how much difficult it is for us humans to read and write in machine language, but we need to make the processor understand our commands and execute them properly, in this case programming languages comes into the picture.

Programming languages gives us an opportunity to give the command to the hardware in human like language. In C/C++ programming language we write the commands in english like language and then the compiler converts it to the machine code. This compiled code is executed by the operating system. In case of Python, the code is written in more human like language which make it more noob friendly. Python code is translated into intermediate code, which has to be executed by a virtual machine, known as the PVM, the Python Virtual Machine. This is a similar approach to the one taken by Java. There is even a way of translating Python programs into Java byte code for the Java Virtual Machine (JVM). Here comes the difference between C and Python. As C language is low level programming language, the c-compiler produces machine code i.e. strings of 0’s and 1’s. This code is directly executed by the operating system, but in case of Python, the code is translated into an intermediate code which can only be executed by the python virtual machine not by the operating system. This gives an edge to the C language to dominate the embeded systems.

What if we can enjoy the simplicity of python and the grip over the hardware as C/C++ both at the same time? It will be much easier for us to code the embeded systems. Well it seems to be not anymore a dream as micropython has made its debut in the embeded world.


MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments. The MicroPython pyboard is a compact electronic circuit board that runs MicroPython on the bare metal, giving you a low-level Python operating system that can be used to control all kinds of electronic projects. MicroPython is packed full of advanced features such as an interactive prompt, arbitrary precision integers, closures, list comprehension, generators, exception handling and more. Yet it is compact enough to fit and run within just 256k of code space and 16k of RAM. MicroPython aims to be as compatible with normal Python as possible to allow you to transfer code with ease from the desktop to a microcontroller or embedded system.


Micropython may become the game changer in the field of embeded systems. As it reflects all the qualities of python3 and can be used to control the hardware with the help of pyboard, it can eventually replace Arduino and dominate in IoT field. For Arduino we use C and sometimes C++ to write the code and then the code is cross-compiled to .hex format which arduino accepts. Using a low-level programming language to program hardware may be beneficial but ultimately it is very much time consuming to code something which will do very little and also the code length will increase like anything. Having a high-level language like python in this field will help the developers to code more efficiently and quickly. As python is a very popular language, micropython has a chance to eliminate all the players from the race of embeded technology.






Comments

Post a Comment

Popular posts from this blog

Linux: Is this the future?

Is it possible to use external Java libraries with out any traditional IDE such as Eclipse or Netbeans?