You are on page 1of 3

Micro-Controller Design Systems – MCD2601

Assignment two
11 March 2021
Question one
1. 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);
2. Calculate the execution time of the following code (Fosc = 12 MHz):

MOV A,#0x07
MOV B,#0x50
MUL AB
SWAP A

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

4. 127 bytes asynchronous data is serially transmitted at a rate of 19200 Baud. How much transmission
time is needed by the 8051 microcontroller to complete the task? No parity is used.

5. Analyse the following C-code and give the content of the variable result:

unsigned char Val_1 = 56;


float Val_2 = 3.281;
unsigned int Result;

Result = Val_1 * Val_2;

Open Rubric
QUESTION 2

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 microcontroller.
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 microcontroller. 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 2.1: Circuit diagram of 8051 controller and peripherals


QUESTION 3

A pressure sensor with amplification is connected to an ADC (12-bit). If the sensor reads 18 bar, the
sensor output is 4V. The pressure range that the sensor can measure is 0 to 18 bar, 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.

You might also like