Assignment 1
Assignment 1
SCHOOL OF ENGINEERING
CONTINUOUS ASSESSMENT
MINOR TEST: 01
2024
MCD2601
2. Open-book assignment.
3. Honour Pledge: I have neither given nor received any aid on the assignment.
4. Plagiarism is prohibited. Plagiarism is the act of taking words, ideas and thoughts of
others and presenting it as your own. It is a form of theft which involves several
dishonest academic activities.
5. This question paper remains the property of the University of South Africa and may
not be copied or printed.
NB.: After downloading the test paper from Additional Resources, under myUnisa platform,
answer the questions and send the answer sheets in the same way you send assignments on
myUnisa!
1
QUESTION 1 (25 marks)
[ 1 mark each except from 1.5 and 1.6 which count 2 marks each]
Give the answers to the following questions in hexadecimal notation, except if specified
otherwise.
Question 1.1
Analyse the following assembly code and give the content of register A in hex format:
MOV A,#234
MOV B,#21
DIV AB
Question 1.2
From Question 1.1, analyse the assembly code and give the content of register B in hex:
Question 1.3
Analyse the following assembly code and give the content of register B in hex format:
MOV B,#0x37
MOV 0x30,#0x03
MOV A,B
Loop: RL A
DJNZ 0x30,Loop
MOV B,A
Question 1.4
Analyse the following assembly code and give the content of register A in hex:
MOV A,#0xCF
MOV B,#0x33
XRL A,B
Question 1.5
Calculate the execution time of the following code (Fosc = 12 MHz):
MOV A,#0x07
MOV B,#0x50
MUL AB
SWAP A
Question 1.6
From Question 1.5, calculate how many bytes will be occupied in program memory.
Question 1.7
Analyse the following assembly code and give the content of register A in hex format:
2
CLR C
MOV A,#0x57
MOV B,#0x42
SUBB A,B
Question 1.8
Analyse the following assembly code and give the content of register A in hex format:
SETB C
MOV A,#223
MOV B,#150
ADDC A,B
Question 1.9
Analyse the following assembly code and give the content of register A in hex format:
MOV A,#11011010B
MOV B,#10110010B
ORL A,B
Question 1.10
Analyse the following assembly code and give the content of register B in hex format:
MOV 30,#0x0A
MOV R0,#0x1E
INC @R0
MOV B,@R0
Question 1.11
Analyse the following assembly code and give the content of register B in hex format:
MOV 50H,#0x3C
MOV R1,#80
MOV A,#0x3F
ADD A,@R1
MOV B,A
Question 1.12
The counter mode selection bits are in the …….. register.
Question 1.13
The bit that indicates that SBUF received a bByte is in register….
Question 1.14
Analyse the following C-code and give the content of the variable rResult:
3
unsigned char Val_1 = 56;
float Val_2 = 3.281;
unsigned int Result;
Question 1.15
Analyse the following C-code and give the content of the variable rResult:
Result = Var;
Question 1.16
Analyse the following C-code and the give the content of the variable result:
Question 1.17
Analyse the following C-code and give the content of the variable result:
Ptr = &y;
x = 14;
Result = *Ptr * x ;
Question 1.18
127 bytes asynchronous data is serially transmitted at a rate of 19200 Baud. How much
transmission time is needed by the 8051 micro controller to complete the task? No parity is
used.
Question 1.19
Analyse the following C-code and give the content of the variable result:
unsigned char Tab[] = {206, 223, 17, 24, 147, 50, 11,40, 43, 219, 253, 238};
unsigned char Index = 5;
unsigned char Result;
4
Result = Tab[Index + 4];
Question 1.20
Analyse the following C-code and give the content of the variable result:
Question 1.21
Analyse the following C-code and give the content of the variable result (in hex):
Question 1.22
Analyse the following C-code and give the content of the VARIABLE RESULT (USE DECIMAL
notation):
Question 1.23
Analyse the following C-code and give the content of the variable result in hex notation:
5
QUESTION 2 (7 marks)
A15
PSEN
A8
AD7
Latch
8051 micro
controller Keypad
AD0
P3.2 EEPROM
RAM 8K ADC 0804
P3.3
32K DA
Encoder
RD ALE
WR
EA
3X8
Decoder
6
QUESTION 3 (8 marks)
A pressure sensor with amplification is connected to an ADC (12-bit). If the sensor reads 18
bars, the sensor output is 4V. The pressure range that the sensor can measure is 0 to 18 bars,
and the output voltage range is 0V to 4V. The internal reference voltage of the ADC is 7V.
3.1 Draw a circuit diagram of the system. Clearly show the amplifier circuit with all
required resistors to get the best resolution.
3.2 Calculate the voltage gain of the amplifier to ensure best resolution.
3.3 Calculate the step voltage of the A/D converter.
3.4 For a sensor reading of 13 bar, calculate the sensor output voltage and the ADC
output code.
3.5 Calculate the scale factor to multiply the ADC output with, in order to display a
sensor reading of between 0 and 15 bar.
7
QUESTION 4 (10
marks)
Write a program in 8051 C or Assembly language that continuously reads a 4-bit code from
Port 3.0
to Port 3.3. This data represents incorrect codes that must be corrected according to the
following table:.