What is a Micro controller?
A micro controller has a CPU in addition to a fixed amount of RAM, ROM,I/O ports, and a timer all on a single chip. So the designer no needs to add any external memory, I/O, or timer to it.
The fixed amount of on-chip RAM, ROM and no. of Inputs/Output ports in micro controllers makes them ideal for many applications in which cost and space are critical.
Embedded Micro controller products:
Remote Controls, Microwave, Printers , Video games , Camera, Security systems.
How to choose a Micro controller?
The criteria for choosing Micro controllers are as follows
- It must meet the task at hand efficiently and cost effectively and in this category
- Power Consumption
- Size of RAM and ROM on chip
- Cost per unit
- Availability of software tools such as compilers, assemblers, debuggers.
- Availability and reliable sources of the microcontrollers means the selected Microcontroller is ready availability in needed quantities both now and in future.
8051 Micro controller Specification?
The 8051 Micro controller has
- 128K bytes of RAM
- 4k bytes of on-chip ROM + 60K bytes maximum
- Four Input/output Ports, each 8 bits wide
- Two timers
- One serial port.
8051 is an 8-bit processor, meaning that the CPU can work on only 8bits of data at a time.
8051 Micro controller is also referred as a “system on a chip “.
8051 assembly Programming steps?
Choose the Editor to write/Edit the assembly instructions/code, usually will use MS DOS editor and the file extension depends on the assembler ,most of the assemblers support s “asm” or “src”.
The Assembler converts .asm file instructions into machine code, the Assembler will produce the Object file with the extension .obj and list file with the extension .lst
The Linker program takes on or more object files (.obj) and produces an absolute object file with the extension has .abs
The OH program means Object to Hex converter which creates a file extension “.hex” that is ready to burn into ROM space.
What is the Program Counter?
Program counter is one of the Register in 8051. Program Counter (PC) points to the address of the next instruction to be executed .the Program Counter in the 8051 is 16 bits wide so it can access the memory 0000 to FFFFH.
What are the Registers in 8051?
The Registers in the 8051 are:
- Accumulator- A
- Register B
- Registers R0- R7
- Data Pointer – DPTR
- Program Counter – PC
- Flag Register – Program Status Word (PSW)
All the above Registers are 8 bit registers except DPTR and Program Counter.
What is PSW (Program Status Word) Register?
PSW is an 8-bit Register it is also called as a flag Register. The 8-bits are as below.
CY (Carry Flag):
- This flag is set when the carry is return from bit D7.
- This flag bit is affected when the addition or subtraction is performed.
- This bit can also be set/clear by instructions SETB C & CLR C.
AC (Auxiliary flag):
- The flag is set when the carry is return from the D3 to D4 by ADD or SUB Instruction
- In the Binary Coded Decimal (BCD) arithmetic operation this flag can be used.
P (Parity Flag):
- This flag reflects the no. Of 1’s in the register A (Accumulator).
- The fla bit P=0 when the no.of 1’s are even numbers
- The flag bit P=1 when the no.of 1’s are odd numbers.
OV (Overflow flag):
- This Flag is used to detect errors in the signed arithmetic operations.
- This flag is set whenever the result of a signed number operation is too large, causing the high order bit to overflow into the sign bit.
The above mentioned four flags are conditional flags, they indicate some conditions that result after an instruction is executed.
What are the Directives of 8051?
The following Directives are widely used in 8051
This Directive is used to indicate that beginning of the address. The number that comes after ORG can either in HEX or Decimal
This is used to define a constant without occupying a memory location. It associates a constant value with a data label so that when the label appears in the program its constant value will be substituted for the label.
This indicates to the assembler the end of the source (asm) file. It will be present last line of the program, so after the END directive the assembler will not consider for the execution.