0% found this document useful (0 votes)
18 views

Assignment 1

Assignment 1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Assignment 1

Assignment 1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

UNIVERSITY OF SOUTH AFRICA

SCHOOL OF ENGINEERING
CONTINUOUS ASSESSMENT

MINOR TEST: 01

2024

MCD2601

MICRO-CONTROLLER DESIGN SYSTEMS

Examiner1: Dr. E MIGABO


Marks: 50
Moderator: Mr. AM DLAMINI Weight of Assessment: 10%

INSTRUCTIONS TO ALL STUDENTS:

1. Use of a non-programmable pocket calculator is permissible.

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.

6. Answer all questions.

Welcome to the School of Engineering.

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!

Please use the correct unique number for this assessment.

Assessment code: 554677


Assessment due Date and time: 20 March 2024 at 23:00

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;

Result = Val_1 * Val_2;

Question 1.15
Analyse the following C-code and give the content of the variable rResult:

unsigned char Result;


unsigned int Var = 0x1234;

Result = Var;

Question 1.16
Analyse the following C-code and the give the content of the variable result:

unsigned char Message[] = “Welcome to menu”;


unsigned char Index = 6;
unsigned char Character;

Character = Message[Index + 4];

Question 1.17
Analyse the following C-code and give the content of the variable result:

unsigned char x, Result;


unsigned char y = 0x04;
unsigned char *Ptr;

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:

unsigned int Result;


unsigned int Var = 0x1234;

Var = Var >> 7;


Result = Var & 0xCDFF;

Question 1.21
Analyse the following C-code and give the content of the variable result (in hex):

unsigned char Value = 0xA3;


unsigned char Number = 0x34;
unsigned int Result = 0;

Result = ((Result + Value) << 3) | Number;

Question 1.22
Analyse the following C-code and give the content of the VARIABLE RESULT (USE DECIMAL
notation):

unsigned char Var_1, Var_2, Result;


unsigned char *Ptr;
Ptr = &Var_2;
Var_1 = 223;
*Ptr = 12;
Result = Var_1 % *Ptr;

Question 1.23
Analyse the following C-code and give the content of the variable result in hex notation:

unsigned int Value = 0x12;


unsigned char Number = 0x34;
unsigned int Result = 0;
Value = Value << 8;
Value = Value | Number;
Result = ((Result + Value) & 0xA4D0);

5
QUESTION 2 (7 marks)

An 8051 micro ,controller must be connected to a latch, an EEPROM, a RAM memory, a


keypad and encoder and an ADC. Figure 2.1 shows the different components. For the
arrangement to work the components must be connected to the address bus, the data bus,
the decoder and the micro controller. The RAM must be connected to address 0x0000 to
0x3FFF, the keypad and encoder to address 0x4000 and the ADC to address 0x6000. The
program that must be executed is in the EEPROM. A crystal must also be connected to the
micro controller. Complete the circuit diagram by connecting all the pins of the controller and
the devices to the correct pins/lines. The missing pin names and line numbers must also be
filled in on the controller and devices.

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

Figure 21.1:- Circuit diagram of 8051 controller and peripherals

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:.

The corrected values should then be written to Port 1.

Data on Port 3 Corrected Code


8 77
5 3
4 10
3 7
1 23
2 9
0 0
7 50
6 4

You might also like