0% found this document useful (0 votes)
66 views5 pages

ES Epad Question Paper - Solution

The document contains a series of multiple-choice questions (MCQs) and assembly language programming tasks related to ARM architecture, I2C communication, and parity calculations. Each question tests knowledge on specific technical concepts, such as register operations, endianness, and programming syntax. The document also includes solutions for certain programming tasks, demonstrating practical applications of the concepts discussed.

Uploaded by

pubpubg190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views5 pages

ES Epad Question Paper - Solution

The document contains a series of multiple-choice questions (MCQs) and assembly language programming tasks related to ARM architecture, I2C communication, and parity calculations. Each question tests knowledge on specific technical concepts, such as register operations, endianness, and programming syntax. The document also includes solutions for certain programming tasks, demonstrating practical applications of the concepts discussed.

Uploaded by

pubpubg190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Type: MCQ

Q1. Find the result of R0 for the following:


MOV R1,#0x6E
RSB R0,R1,#0 (1)

1. ** FFFFFF92
2. FFFFFF93
3. FFFFFF91
4. FFFFFF94

Q2. For the packed BCD number 0x41, give the ASCII representations. (1)
1. 0x04,0x01

2. 0x40,0x10
3. 0x43,0x13

4. **0x34,0x31

Q3. Write the instructions using MLA for performing the given calculation.
R3 = R5 × R2+ R6 (1)

1. MLA R2,R5,R3,R6
2. **MLA R3,R5,R2,R6
3. MLA R6,R3,R5,R2
4. MLA R3,R5,R6,R2

Q4. A CPU writes register content into the memory in a Big-endian mode. When the same content is
read back from memory into a register, the CPU reads it in Little Endian mode as (1)

1. ** The new content in the register will be different from what was written
2. The content will be the same
3. The content may be same or different
4. Endianness need not be the same while reading and writing the contents into/from the
memory

Q5. How many bits are required to specify the Register operands in an ARM7 instruction format? (1)
1. 32 bits

2. 16 bits

3. ** 4 bits

4. 2 bits
Q6. What should be the Mask for configuring port P1.19 to GPIO mode for the LPC1768
microcontroller? (1)

1. PINSEL4 &= 0XFFFFFF3F


2. **PINSEL3 &= 0XFFFFFF3F
3. PINSEL1 &= 0XFFFFFF3F
4. PINSEL2 &= 0XFFFFFF3F

Q7. What is the role of the Slave Address in an I2C communication transaction? (1)
1. It specifies the clock frequency for communication
2. It identifies the master device on the bus
3. **It identifies the specific slave device intended for communication
4. It determines the data packet size

Q8. Consider the BNE Loop as currently executing instruction. Calculate the target address of
branching using the data given below.
ADDRESS MACHINE MNEMONIC OPERAND
00000004 EA000002 B LOOP (1)

1. 00000006
2. 0000000A
3. **00000014
4. Insufficient data

Q9. Which of the following statements is true about BL Delay (1)


1. BL calls the subroutine delay and saves the address of the instruction below BL in pc register.
2. BL calls the subroutine delay and saves the address of the instruction BL in pc register.
3. ** BL calls the subroutine delay and saves the address of the instruction below BL in LR
register.
4. BL calls the subroutine delay and saves the address of the instruction below BL in pc register.

Q10. Write the content of the register R0, R1, R2 after execution of below program

AREA MYCODE, CODE, READONLY


ENTRY
LDR R0,= 0X34F
MOV R1, #0
MOV R2, #32
AGAIN MOV R0,R0, RRX
ADDCS R1, R1, #1
SUBS R2, R2, #1
BNE AGAIN
END (1)

1. ** R0= 0xFFE00000, R1= 0x0000000B, R2= 0x00000000


2. R0= 0X34F00000, R1= 0x0000000B, R2= 0x00000000
3. R0= 0X3FF00000, R1= 0x0000000C, R2= 0x00000000
4. R0= 0XFFE00000, R1= 0x0000000C, R2= 0x00000000

Type: DES

Q11. For 2 and 7 the keyboard gives 0x32 and 0x37, respectively. Write an assembly language
program to convert 0x32 and 0x37 to packed BCD and store the result in R4. (5)

Solution:
AREA RESET, DATA, READONLY
EXPORT __Vectors

__Vectors

DCD 0x40001000 ; stack pointer value when stack is empty


DCD Reset_Handler ; reset vector

ALIGN
AREA mycode, CODE, READONLY
ENTRY
EXPORT Reset_Handler

Reset_Handler

MOV R1,#0x37 ;R1 = 0x37


MOV R2,#0x32 ;R2 = 0x32
AND R1,R1,#0x0F ;mask 3 to get unpacked BCD
AND R2,R2,#0x0F ;mask 3 to get unpacked BCD
MOV R3,R2,LSL #4 ;shift R2 4 bits to left to get R3 = 0x20
ORR R4,R3,R1 ;OR them to get packed BCD, R4 = 0x27

STOP

B STOP

Q12. Write an assembly language program to find the parity of a given 32-bit number using a sub-
routine. Move the parity to the R0 register. The parity of a binary number indicates whether it
contains an odd or even number of ones. Parity will be set 1 if data contains an odd number of ones
and it will be set 0 if it contains an even number of ones (5)

Solution:
Q13. Write a program in embedded C to display all the even Hexadecimal numbers starting from
0x0 to 0xF. (Hint: 2,4,6,8,A,C,E) (5)
Solution:

#include <LPC17xx.h>

unsigned int delay, count=0, Switchcount=0.j;

unsigned int Disp[7]={ 0x000005b0, 0x00000660, 0x000007d0, 0x000007f0, 0x00000770,


0x00000390, 0x00000790};

#define ALLDISP 0x00180000

#define DATAPORT 0x00000ff0

int main (void)

LPC_PINCON->PINSEL0 = 0x00000000;

LPC_PINCON->PINSEL1 = 0x00000000;

LPC_GPIO0->FIODIR = 0x00180ff0;

While(1)

LPC_GPIO0->FIOSET |= ALLDISP;

LPC_GPIO0->FIOCLR = 0x00000ff0;

LPC_GPIO0->FIOSET |= Disp[Switchcount];
for(j=0;j<3;j++)

for(delay=0;delay<200000;delay++);

Switchcount++;

if(Switchcount == 0x10)

Switchcount = 0;

LPC_GPIO0->FIOCLR |= 0x00180ff0;

Q14. Write a program to add ten 32-bit numbers available in code memory and store the result in
data memory. (5)
Solution:

AREA RESET, DATA, READONLY


EXPORT __Vectors
__Vectors
DCD 0x40001000 ; stack pointer value when stack is empty
DCD Reset_Handler ; reset vector

ALIGN
AREA aa,CODE,READONLY
entry
ldr r0,=0x40000000 ;storing the initial adress of the array to register r0
mov r2,#0x0A ;Counter
mov r3,#0x00 ;Stores the total sum of 5 32 bit numbers
label
ldr r4,[r0],#4
add r3,r3,r4
subs r2,r2,#0x01
bne label

stop b stop
end

You might also like