★ Microcontroller verses general purpose microprocessor :
Microprocesses contain no ram , no ram no IO podes on the chip therefore they are called general purpose microcontroller . so, all these have to be added externally to make microprocessor functionally, which makes system bulkier and expensive but the system become versatile.
A microcontroller has CPU in addition to a fixed amount of ram , ram & IO podes a timer all on a single chip this is also called embeded system and in this way cost and space is reduced sum microcontroller are integrated with ADC and other periferals also.
The 8051 microcontroller :-
This is an 8 bit microcontroller have 128 bit of ram, 4K bit of ram, 2 times , 1 serial port and four 8 bit ports. The 4K bit ram can be extended upto 64K bit ram.
The 8085 assembly language programming.
1. Inside the 8051 microcontroller.
2. Resistors :- sum of the widely used 8 bit & 16 bit resistors in 8051 are :-
8-bit resistors :- A , B , R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7.
16- bit resistors :- DPTR ( Data pointer) = DPH + DPL , PC
(program counter ) . A is the accumalater used for all arithmetic and logic instruction.
★ Mov instruction:-
Formate
Mov Destination , Source
1, MOv A , # 55H load value 55H into registor A.
2.Mov R0, A copy containts of A into R0.
3. MOv R5 , # 0f9H load F9 into R5.
Node 1 :- Value can be loaded directly to any registors . The loaded value should # sign before it.
Node 2 :- The zero between # and f is show F is hex no. and not a letter otherwise it causes errors.
4. Mov A , #5H is same as Mov A , # 05
5. Mov B , 17H copy containt present in memory location 17xB.
★ ADD Instructions :-
Formate
Add A , Source
1. ADD A , R2 ( ADD containt of R2 to A )
(A = A +R2)
2. ADD A , #34H ( ADD 34H to A ) .
( A = A + 34H )
An assembly language contains instruction and directive instructions test the CPU what to do and directives also called pseudo instructions gives direction to the assembler.
ORG and are directives to the assembler.
Example :- PRG , OH telse the assembler to place the op- code at memory location zero wild end. Indicates to the assembler the end of the source code in other words one is the start of the program and other is the end of the program.
Here brackets indicates that the field is optional.
1. The level field allows the program to refer to a line opcode by a name.
2. The nemonic and operands (S) field together perfrom the real work.
★ Program Counter (PC) :-
The PC points to the address of the next instruction to be exiated the microcontroller wax up at memory address 000H when it is power up.
★ DB directive (Define byte ) :-
DB directive is mostly used data directive is the assemble it is used to define 8 bit data. The data
be in decimal , binary , or ASCII formate.
For Example :- The " D" after the decimal no. is optional but "B" ( Binary ) , "H" ( Hexadecimal) is required . The assembler converts the no. into hex. To indicate ASCII simple place it in cotation marks ("like this ") following some
Examples :-
1. DB 28 : Decimal (1C in hex ).
2.DB 00110101 B : Binary (35 in hex ).
3.DB 39H : (Hex0.
4.DB "MY NAME" :, (ASCII Characters ).
5.DB "2591" : (ASCII Numbers ).
★ ORG (origin) :-
This directive is used to indicate the start of the address the no. that comes after ORG. we can either in hex or decimal. If the no. is not followed by H Then, it is decimal no. and assembler will convert it decimal no.
★ EQU (Equate) :-
This is used to define a constant without occupied a memory location.
Ex:- COUNT EQU 25
MOV R3 , # COUNt.
Here, the registor R# will be loaded with value 25.
★ END Directives :-
This indicates to the assembler the end of source (ASM ) file.
★ 8051 Flag (PSW registor ):-
It is an 8 bit registor 6 bit of it are used by 8051 and 2 bit are user definable flags. Flour flags are called conditional flags these are CY , AC , and OV ( overflow ).
No comments:
Post a Comment