8051 — The Genesis of My Embedded Experience

Kshitij Vaze
6 min readOct 14, 2023

--

Welcome back to my blog. Before anything else, I just want to thank all of you lot for the incredible reception on the previous post. It’s really fulfilling to see all the love and appreciation that these pieces receive from my readers, and it helps me keep pushing as well. If you are new here, let me introduce myself. I am Kshitij Vaze, a third-year student, pursuing my Bachelor in Electronics and Telecommunication Engineering. I work at Team Automatons as an embedded systems engineer. This blog serves as a technical and personal document of my journey and experience with embedded hardware, programming, and applications.

I believe it is very important to know and understand the timeframe and flow of development of any topic of academic interest. Embedded systems and microcontrollers are not different. It was at the dawn of the decade of the 70s when a man named Gary Boone put his innovative mind to work at Texas Instruments and birthed the very first Microcontroller. His motive may have been trivial — to compress all the functions of a calculator onto a single chip, but his work and the subsequent creation that was mundanely named “TMS1802NC” has proven to be the start of micro-computing.

As soon as the word of this chip spread within the business circles of the early 70s, the demand for it increased exponentially. TI marketed these chips very successfully, and the production had to be ramped up. Now, unlike the modern day, TI had to make a separate chip for each company, and most of the time, their specifications varied just a tiny bit. Boone and his team were really bored with making practically the same chip over and over again, and out of his boredom, he thought about creating a single chip that could be programmed by the customers to work according to their own needs and requirements. Thus, due to a single man being bored with his job, the very first series of microcontrollers “TMS 100” was released. Used internally by TI from 1972–74, it was made commercially available in the latter half of 1974.

Inspired by similar motives, however, was another electronic giant lurking in the shadows. Towards the late 70s- early 80s, Intel was quietly developing its own microcontroller; the famed 8051. This tiny little Integrated circuit, is capable of working with 8 bits of data at a single time, making it one of the most capable chips of its time. It was first manufactured using the NMOS (N-Type Metal Oxide Semiconductor) technology, but subsequent versions have been made via the CMOS (Complementary Metal Oxide Semiconductor) technology. It is also referred to as a System on Chip, as it has multiple circuits, such as data storage, ALU, timer/counters, and many more on a Single integrated circuit.

Talking about the technical specifications -

  • The 8051 is based on the Harvard architecture, which means that it has a separate bus (pathway for data to flow through ) for data and addresses. The data bus is 8-bits wide and can travel in both directions, that is to the processor and away from the processor. The address bus, however, is 16 bits wide and can only travel away from the processor.
  • The entire operation is controlled by an external crystal oscillator, that runs at 12 Mega Hertz. It takes 1 microsecond to complete a single instruction cycle.
  • In the memory department, the 8051 packs 4 Kilo Bytes of Read-only Memory (ROM) and 128 Bytes of Random access memory ((RAM), out of which, 16 Bytes are Bit addressable.
  • To help interface with the outside world, the 8051 has 4 ports of 8 pins each. Also, the board has 2 timers, each 16-bit wide. Lastly, the 8051 has 2 internal and 3 external interrupts.

the 8051 proved to be a cornerstone in the story of embedded system development. It was so massively popular, that its subsequent modifications are still kicking about in some electronic devices to this day! I believe it was the board that popularized the advent of microprocessors and eventually created modern electronics as we know it today.

For me, it served as the perfect introduction to embedded systems. You see, my work with this board was similar to that of an archeologist with a relic. It was through the process of learning the ins and outs of this board that I fully understood the dark arts that I was indulging with.

Coding for this board using assembly forced me to read and understand the position and purpose of each and every bit of every single register. And to conceptualize a bit of data flowing from one register to another, and then watch it move exactly like I intended for it to move; to think about controlling and operating a mechanical system simply by shifting zeroes and ones into a cell of memory and then watch it happen with the utmost precision; what better feeling than experiencing perfection in execution of your own thought?

To start with, my first task was to understand the inner architecture of the board, which included understanding the organization of peripherals, buses, clocks, memory and registers inside the microcontroller. I learned about their interconnections and briefly understood the limitations of each individual component.

Next, I learned about the operation of the most basic peripheral of the controller — the General Purpose Input Output (GPIO) pins. These are bi-directional pins that facilitate the interaction between our controller and the outside world. 8051 has 32 of these, divided into 4 ports of 8 each. Once I was confident about my knowledge of its working, it was time to put it to the test. The very first task I was given was to blink an LED using the GPIO pins, and I wrote the code in assembly. The IDE I worked on was named KEIL, developed by ARM.

Once I was proficient with the hardware aspect of the board, it was time to level up my programming skills. I learned about the different modes of addressing a processor, accessing and interfacing with the onboard RAM and ROM as well as the external RAM, and wrote application code in assembly for tasks such as memory block shifting, finding the largest number from a given set, and interfaced with basic sensors such as the IR sensor.

The next peripheral I worked with were the timers of 8051 and used for a variety of purposes, such as generating multiple types of waveforms at the output, blinking an LED at a specific time had passed, etc.

After this, I learned and implemented the Interrupt configuration for the 8051, which basically stops all other functions of the controller and executes the code written under the interrupt function. This helped me learn much more about things like HEX to Decimal conversion.

My final theoretical topic was to cover the communication protocols that were supported by 8051 and develop applications for communicating with the outside environment via serial modes of communication.

So the experimental applications developed by me on the 8051 are as follows

  • 4x4 matrix keyboard
  • 7-segment display
  • Analog to digital converter
  • temperature sensor
  • relays
  • Digital to analog converter
  • Stepper motor drive interfacing
  • square, sine, triangular, and stair-case waveform generation
  • frequency counter
  • 16x2 LCD display

All interfacing was done in assembly language over on the Keil IDE, and in the upcoming blogs, I plan on writing in depth about all of em. And with that, I conclude my experience with the 8051. If you made it here, I’d like to thank you for reading through the whole blog. If you have any questions or wish to discuss any of the topics I mentioned over here, feel free to drop a comment. If you found any value in this blog post, please share it with your friends and colleagues, and as always, see you next week!!

--

--

Kshitij Vaze

Engineering Student, upcoming embedded solutions architect