Skip to main content

How to program 8051 based MCU using Ptroteous Schematic capture and Source code editor to use timers using AT892051 + project files




 This tutorial is dedicated to use a 8051 based Microcontroller core and program it using keil's C51 tools on the Proteus Source code editor. 


1- Brief History of 8051

one of the first microprocessors 4004 was invented by Intel Corporation as well as  8085 and 8086 microprocessors back in 1981,shortly after Intel introduced an 8-bit microcontroller called the 8051. It was referred to as system on a chip because it had 128 bytes of RAM, 4K byte of on-chip ROM, two timers, one serial port, and 4 ports (8-bit wide), all on a single chip.
When it became so widespread, Intel allowed other manufacturers to make and market different flavors of 8051 with its code compatible with 8051. It means that if you write your program for one flavor of 8051, it will run on other flavors too, regardless of the manufacturer. This has led to several versions with different speeds and amounts of on-chip RAM.

2- Features of AT892051 Microcontroller

  • Compatible with MCS®-51Products
  • 2K Bytes of Reprogrammable Flash Memory–  Endurance: 10,000 Write/Erase Cycles
  • 2.7V to 6V Operating Range
  • Fully Static Operation: 0 Hz to 24 MHz
  • Two-level Program Memory Lock
  • 128 x 8-bit Internal RAM
  • 15 Programmable I/O Lines
  • Two 16-bit Timer/Counters
  • Six Interrupt Sources
  • Programmable Serial UART Channel
  • Direct LED Drive Outputs
  • On-chip Analog Comparator
  • Low-power Idle and Power-down Modes
  • Green (Pb/Halide-free) Packaging Option
  •  

3- Description of AT892051  

The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a power-ful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

4- Block diagram



Figure 1 :  AT89C2051 Block diagram from manufacturer's Datasheet

5- Setting up C51 to use it with Proteus code editor

First go to the following link to download C51 from Keil.com After download and installation make sure that you can find the compiler within Proteus Like so Figure 2.

 Figure 2 : list of installed and usable compilers in the Proteus source code editor settings

Now we are ready to start working on an example project.

6- Starting a new project


Lets start a new Project in proteous and let's search for AT89C2051  

 Figure 3 : Selecting a component

After that you will need to place the component in the schematic's layout grid. that's it you are ready to go.
Now click on the component properties and  then click on the edit firmware button like shown in Figure 4, and a window with basic code will show up.




 Figure 4 : Opening Firmware editor in Proteus


 Figure 5 : New firmware project (Make sure to select Keil for 8051)


In this project we will try to use timer 0 to generate a PWM signal on pin using interrupt 0. Write the following code to your project, and you will be able to adjust the PWM duty cycle on each pin using pwm_pinx variable inside the code. 



Now you can compile the given code, and if every thing goes right you will receive the following message.

Figure 6 : Successful compilation output 

 

Finally, we set up our probes to execute the simulation on the Proteus project.

Figure 6 : Successful compilation output 


7- Conclusion

This project is a great opportunity to get started with learning 8051, you can refer to the datasheet of the IC to understand how you can use the other available peripherals on board.
You can download and tweak the project using This link

Comments

Popular posts from this blog

How to Play a Sound After a Terminal Command Completes

  Sometimes, while working on the terminal, especially during long-running processes, it’s useful to have an audible notification when the task is finished. In this guide, we’ll show you how to make your terminal play a sound after any command completes, ensuring you're alerted without constantly checking the terminal. Why Do This? This trick can save time and improve workflow, especially when: You’re running lengthy build processes or installations. You’re waiting for large file transfers. You're programming embedded systems and need confirmation when flashing is done. Let’s dive into how to do this on a Linux system. Step-by-Step Guide to Playing a Sound After a Command 1. Using paplay or aplay to Play Sounds On most Linux distributions, you can use paplay or aplay to play sound files directly from the terminal. Here's how you can append a sound notification after a command. Basic Command Structure : PC:~$ your_command && paplay /path/to/soundfile.oga  Or, if...

Building a Robot Actuator with ESP32 and a 5010 BLDC Motor

Introduction Modern robotics demands actuators that aren’t just strong, but also smart — capable of precise control, smooth motion, and safe human interaction. Traditional servos are great for small robots, but they can be stiff, noisy, and limited in range or torque. This project demonstrates a custom robot actuator built around a 5010 360 KV brushless DC (BLDC) motor , controlled by an ESP32 running the SimpleFOC library. The goal is to create a compliant joint — one that can be moved by hand, but automatically returns to its home position with adaptive stiffness. 🧠 What Makes This Actuator Special Unlike a typical servo, this actuator behaves intelligently : You can turn it by hand — it feels soft and back-drivable. When you release it, the motor returns to its initial position smoothly. If you twist it harder (e.g., due to gear reduction), it becomes stiffer , resisting displacement more strongly. It’s powered by 12 V and controlled by a simple ESP32 boar...

Heating with Electric Radiators

You want to heat your small garage using a couple of electric radiators. The power and voltage requirements for each radiator are 1200 W, 240 V. But you are not sure how to wire the radiators to the power supplied to the garage. Should you use the wiring diagram on the left or the one on the right? Does it make any difference?