Sunday, August 15, 2010

Microprocessors and Microcontrollers 13th Aug.

High level Language (using interpretator/compiler)------------->Machine Language
Low Level Language (using Assembler) ------------------------->Machine Language

Interpretor: If any error in line(say line no 40)then the interpretor stops.Ex- Basic
Compiler: If any error is detected (say in line 30), then it will continue to process until the end of the program.(thus it will also give all the errors). Ex- C

JAVA-Compiler+Interpretor


Register Related Instruction
----------------------------------

ADD B

Operation: A <- [A]+[B]
ADD: is operational (or Op) code whose size is 8 bit(or 1 byte)
note: every op-code is of 1 byte size


Data Related Instruction
-----------------------------
ADI 07H

operation: A <- [A] + 07H
ADI:Add Immediate- 1 byte
07H: Data (in hex)- Size 4 + 4 bits = 8bits = 1 byte
Total size: 2 bytes
Address Related Instruction
---------------------------------

JMP 2000H

JMP:1 Byte

2000H: 4 + 4 + 4 + 4 = 16 bits = 2Bytes

Total Size: 2 + 1 = 3 Byes

Code-----------Operation-------------------Bytes ==============================================================
ADD B---------A <- [A] + [B]------------------1

ADI 07H-------A <- [A] + 07H----------------2

ANA B---------A <- [A] and [B]---------------1

ANI 07H-------A <- [A] and 07H-------------2

ORA C---------A <- [A] or [C]----------------1

ORI 07H-------A <- [A] or 07H--------------2

XRA B---------A <- [A] XOR [B]-------------1

XRI 07H-------A <- [A] XOR 07H-----------2

MOV A,C-------A <- [C]---------------------1

MVI A,07H-----A <- 07H-------------------2

STA 0705H---------------------------------3

STA: means the content of the accumulator will be transferred to the 0705H location

LDA 2010H---------------------------------3

LDA: means the content at 2010H will be stored at the accumulator

JMP 2050H----------------------------------3

After executing the instruction the control will be transferred to 2050H location.

INR B---------B <- [B] + 1--------------------1

DCR B---------B <- [B] - 1--------------------1



Q. Write the instructions for : B + C

ANS.

MOV A,B

ADD C


Q. How to reset the accumulator?

Ans. There are three methods, but i will show you only the method you have to use...

XRA A

Its because if we apply XOR to same value, the output is always zero.

Q. 1+2+3+4............10

Ans.

MVI B,0AH---------//10 i.e. OAH is stored in he Register B

XRA A--------------//Reseting the accumulator

XY: ADD B---------// A <- [A] + [B] so, A<-10

DCR B--------------// B <- [B] - 1 so, B<-9

JNZ XY------------//Control will go to line XY until value of B is zero



No comments:

Post a Comment

Featured Post 1

notice

Featured Post 2

IETE

Featured Post 6

results

Featured Post 7

WBUT

Featured Post 3

Featured Post 4

Featured Post 5

Featured Post 8