Why I wrote Turbo51 - Pascal compiler for 8051 microcontrollresThe majority of computer systems in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. These are called embedded systems. An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Embedded systems control many of the common devices in use today.
While some embedded systems are very sophisticated, many have minimal requirements for memory and program length, with no operating system, and low software complexity. Typical input and output devices include switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer, and may lack human interaction devices of any kind.
A key component in many embedded systems is a microcontroller. A microcontroller (also MCU or uC) is a functional computer system-on-a-chip. It contains a processor core, memory, and programmable input/output peripherals. Microcontrollers include an integrated CPU, memory (a small amount of RAM, program memory, or both) and peripherals capable of input and output. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, remote controls, office machines, appliances, power tools, and toys. By reducing the size, cost, and power consumption compared to a design using a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to electronically control many more processes. One of the still very popular 8-bit microcontrollers is Intel 8051.
The Intel 8051 is a Harvard architecture, single chip microcontroller which was developed by Intel in 1980 for use in embedded systems. Intel's original versions were popular in the 1980s and early 1990s, but has today largely been superseded by a vast range of faster and/or functionally enhanced 8051-compatible devices manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies (formerly Siemens AG), Maxim Integrated Products (via its Dallas Semiconductor subsidiary), NXP (formerly Philips Semiconductor), Nuvoton (formerly Winbond), ST Microelectronics, Silicon Laboratories (formerly Cygnal), Texas Instruments and Cypress Semiconductor. Intel's official designation for the 8051 family of microcontrollers is MCS-51.
Several C compilers are available for the 8051, most of which feature extensions that allow the programmer to specify where each variable should be stored in its six types of memory, and provide access to 8051 specific hardware features such as the multiple register banks and bit manipulation instructions. Other high level languages such as Forth, BASIC, Pascal/Object Pascal, PL/M and Modula 2 are available for the 8051, but they are less widely used than C and assembly.
In embedded world C is almost a standard for programming language. There are many debates on which language is better, in particular between C and Pascal users. There is no clear winner.
C is a general-purpose, cross-platform, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. Although C was designed for implementing system software, it is also widely used for developing application software. It is widely used on a great many different software platforms and computer architectures, and several popular compilers exist. C has greatly influenced many other popular programming languages, most notably C++, which originally began as an extension to C.
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using so-called structured programming and data structuring. A derivative known as Object Pascal was designed for object oriented programming.
Since there are a lot of excellent C compilers for 8051 you might ask why Pascal? I just like it. My experience with the 8051 architecture started with reverse engineering of some consumer electronics firmware in late 80s. At that time everything was done in assembly language and I wished there was a Pascal compiler for the 8051 architecture. There were some, but poor and expensive. As time went on, I worked on many projects involving 8051 derivatives. And then I found some literature about compilers.
Development of Turbo51 started in 2000 when I found that there is no good Pascal compiler for the 8051 family of microcontrollers and decided to write my own. Since I had a lot of experience with the Borland Turbo Pascal I decided to create a Pascal compiler for 8051 that will be fast as Turbo Pascal, will have the same syntax and will generate high quality optimized code. First I wrote Turbo Pascal compiler in Turbo Pascal. This compiler is completely source code and binary code compatible with the Borland Turbo Pascal 7.0 command line compiler TPC.EXE. This means that it uses the same syntax and generates exactly the same compiled units and 16-bit code for x86. Then I modified this compiler to compile with Delphi. And the next stage was Turbo51 - a Turbo Pascal compatible compiler for 8051 microcontrollers.
In 2005 the Turbo51 was stable and reliable enough to be used for a real project. And it was. Since then I am using it for every project involving 8051 derivative microcontrollers. In 2008 I have decided to release it as freeware.
Since recently there was no reliable and efficient Pascal compiler for the 8051 microcontrollers. Now this has changed. Turbo51 is a free Pascal compiler for the 8051 family of microcontrollers. If you are programming for the 8051 family of microcontrollers and you like Pascal programming language then you will love Turbo51.
Main features of Turbo51 are:
One of the key strengths of Turbo51 are optimizations to generate compact code. Turbo51 uses the following optimizations:
Turbo51 is released as a freeware. You can use Turbo51 for hobby projects and for serious work. Documentation web pages and code examples show the syntax, features and generated files. This should be enough to start a 8051 project development with Turbo51. And if you are still missing something or have a problem you can always ask me for help.
If you are already familiar with 8051 assembly language programming you can start with Turbo51 as 8051 assembly language compiler and then add some Pascal statements until you become familiar with Turbo51 and Pascal syntax. A good approach is also to compile some Pascal code and then check generated code (ASM file). This way you can learn assembly language, get some ideas on how to write effective code and become familiar with the compiler. Turbo51, like many popular C compilers for 8051, generates optimized code and supports source-level debugging with OMF object file.
It is always good to have a choice. And with Turbo51 you have it. You can choose between plethora of C compilers and Turbo51 - a free Pascal compiler for 8051.
Download Turbo51 - Pascal compiler for 8051 microcontrollers