Mechatronics Midterm Papar PDF
Mechatronics Midterm Papar PDF
17JZMEC0176
Question No.01
Answer:
Given
The data is coming for MPU through 2 input ports F1H and F2H attached with the two furnaces
and an output port with the address F3H attached with the two spray paint nozzles & a display.
Required:
commented assembly language program in order to read the first temperature reading of the
furnace 1 from input port F1H and save the data to the register B as well as to read the first
temperature reading of the furnace 2 from input port F2H and save the data to the register C.
Then, subtract the content of register C from B and display the result at port.
Solution:
Comments
Since its straight forward to write an assembly program
Read from input port F1H
IN F1H
OUT F3H Display the data of the accumulator A on the output F3H
HLT
Name: Abdullah Reg No. 17JZMEC0176
Question No.02
Answer
Given:
sets of five temperature readings of the first and second furnaces are
recorded in hexadecimal as: Data (H):
First Set: 72, 79, 68, 7A, 7F
Second Set: 61, 68, 69, 72, 6F
Required
Write a program to load or store the first set of temperature values of the first furnace in the memory
location starting from 2500H and the second set of temperature values of the second furnace in the
memory location starting from 2300H.
MVI M,79H
INX H In the HL pair register INX H will increase the value of the
location by 1
MVI M,68H
i.e. if HL pair register have 2500H
INX H
and we Appling INX opcode on HL
MVI M,7AH
it valves become 2501H
INX H
MVI M,7FH
LXI H,3500H
MVI M,61H
INX H
MVI M,68H
INX H
MVI M,69H
INX H
Name: Abdullah Reg No. 17JZMEC0176
MVI M,72H
INX H
MVI M,6FH
HLT
Question No.02
On second method
Solution:
Here we will use only LXI and MVL opcode MVI is a mnemonic, which actually means
Since “Move Immediate”
Question No.02
On 3rd method
Solution: STA is a mnemonic that stands for STore
Accumulator contents in memory.
Here we will use only STA, INX and MVL opcode
Since
MVI is a mnemonic, which actually means
MVI A,72H “Move Immediate”
STA 2500H instruction.MOV copies the source operand to
the destination operand without affecting the
MVI A,79H
source
STA 2501H
MVI A,68H
STA 2502H
MVI A,7AH
STA 2503H
MVI A,7FH
STA 2504H
MVI A,61H
STA 3500H
MVI A,68H
STA 3501H
MVI A,69H
STA 3502H
MVI A,72H
STA 3503H
MVI A,6FH
STA 3504H
HLT
Name: Abdullah Reg No. 17JZMEC0176
Question No.03
Answer:
Here we will use LDA, MOV, SUB, OUT and HLT opcodes
Question No.04
Answer
Given
Register C value is 68H
Accumulator A value is 69H
the R/W memory location begins at 0200H
Required
I. Perform subtraction manually the content of register-C from the content of accumulator.
II. If the answer is negative, then
determine the logic of the data bits (D7 to D0) combination at the output port in order to turn on
spray paint 1 and 2.
III. The appropriate mnemonic instructions along with Hex machine code for the microcomputer to
turn on spray paint 1 and 2
Solution:
S Z X AC X P X CY
1 0 0 0 0 1 0 1
Name: Abdullah Reg No. 17JZMEC0176
JNC a16, which stands for “Jump if Not Carry” and “a16”stands
for any 16-bit address
0203H MVI C,68H 0E ,68 This instruction will not get control now
as JNC will transfer the control to the
memory address 2000H
0204H MVI A,69H 3E,69
Subtract the valve Register C from the
value of accumulate A and store the
0205H SUB C 91
answer in A
Question N0.05
Answer
We have to writer all 16-address line
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
0 0 1 0 0 0 0 0 0 0 0 O 0 0 0 0
0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1
23FFH
Name: Abdullah Reg No. 17JZMEC0176
Question No.07
Answer
Given
2megabytes memory (2048K)
Required
Number of address line to address two megabytes
(2048 K) of memory
Solution:
Since
2x=y
Where,
X= number of the address line and y= number 0f passible combination
So, putting y=2048k in the above equation
2x=2048k
=2048*1024
=211*210
2x=221
Now taking log both side
Log2x=log221
X log2=21log2
X log2=21log2 => log2 will be cancel both side
X=21
QuestionNo.08
Answer
8085/8080A microprocessor differentiate between the data and the instruction.
The 8085/8080A microprocessor differentiate between the data and the instruction in the following
manner.
As soon as microprocessor is turned on it begins execution opcode in the memory step wise. When
the first m/c code of an instruction is fetched and decoded in the instruction register the
microprocessor recognizes the number of bytes required to fetch the entire instruction the
8085/8080A microprocessor interprets the interprets the first byte it fetches as opcode and second
as data
For example
We tell the processer that our programs begin at 2000H the first code it fetches is 3EH When it
decodes it knows that it is a 2-byte instruction, hence the second code i.e. 32H is a data byte if we
enter 06H instead of 32H then it will load 06 in the accumulate instead of 32