In the previous chapter we were introduced to 8051 microcontroller. We learnt about the pins, ports, the architecture, block diagram applications and functionalites. So in this chapter, you will be getting started with the 8051 microcontroller. The chapter is full of brief explanation about how to program the microcontroller as well as getting started. So in the next chapter you will be learning about how to connect the microcontroller with other electronic components as well as controlling them. Let's get started!
Getting started.
There are two parts when designing an embedded system which is the software and hardware. The hardware part is the connection of other electronic components like motors, LCD, touchpad, LEDs, and this are called pheripherals. In this chapter I won't touch the hardware part, the software part would just be briefed.
But before going into details, summarizing about the 8051 microcontroller. It's a 40 pin device, it has 4 ports and each ports consists 8 pins. It means 4×8=32 pins.
These pins are used to input/output operation while some pins have dual functions like timer, interrupt etc.
Among these 32 pins, two pins are for power supply and ground (pin 40 and 20), two pins to connect crystal oscillator (pin 18 & 19), 3 pins to connect external memory, (pin 29, 30, 31) and one pin for reset function (pin9).
8051 MIC has two types of memory RAM and flash memory (EEPROM), they have different sizes according to the model of microcontroller, like RAM is 256 bytes and flash is 8k for AT89S52. After going through this tutorial, we can go ahead to interfacing an LED with 8051 microcontroller.
IDE for programming.
The IDE is an integrated development environment where codes are written, complied and uploaded to the board or chip you want to program. It's a software which you install on your smartphone or a personal computer where you develop codes. It has a notepad for editing and writing codes.
Once the code is written, it's then compiled into a language the microcontroller or processor can understand and then uploaded on in with just a click of a button through a USB cord.
The most common IDE for programming 8051 microcontroller is the keil. This is what the IDE looks like when opened.
Keil Integrated development environment (IDE).
Burning the code.
After writing the code, which is a set of instructions designed to control the microcontroller, the next thing is to upload the code to the microcontroller after after when it's complied, and this process is called burning.
To upload the code, a separate circuit is required to achieve this, circuit board called a burner. You can build the circuit yourself, but if you a beginner it's advisable to buy.
When the program is complied on the IDE, from the computer, the complied code is called an HEX file.
The microcontroller doesn't. inderstand the c programe high level programming language that is why we need an HEX file. The HEX file is in machine level language, which microcontrollers understand. For example let assume we have written our code and we have also compiled it in the IDE, to upload the code to the microcontroller we need a burner or programmer. To load the code the microcontroller is plugged into the pins of the burner and the board's USB is connected to a computer for programming. The burner is available in our store at cheap price about $5 to $10.
An ISP(In System Programming) is a simple way to program a microcontroller, you don't need to take out the microcontroller from the board each time you program it.
Tags:
Embedded System