0% found this document useful (0 votes)
3 views4 pages

Micro T3

The document is a tutorial for a microcomputer system course, containing a series of questions and programming tasks related to addressing modes, assembly language instructions, and memory operations. It includes exercises on various addressing modes, assembly code writing for data manipulation, and logical operations. The tutorial aims to enhance understanding of microcomputer programming concepts and practical applications.

Uploaded by

monakt884
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)
3 views4 pages

Micro T3

The document is a tutorial for a microcomputer system course, containing a series of questions and programming tasks related to addressing modes, assembly language instructions, and memory operations. It includes exercises on various addressing modes, assembly code writing for data manipulation, and logical operations. The tutorial aims to enhance understanding of microcomputer programming concepts and practical applications.

Uploaded by

monakt884
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/ 4

CE224 Microcomputer System (Tutorial3)

Q1__Answer the following:-

a) What are the general purpose addressing mode?

b) Explain the following instructions and determine the addressing mode?

AND R16, R17

MOV R23, R19

SUBI R19, 0x6

c) What are the I/O addressing mode? Explain with examples?

d) What are the data memory addressing modes? explain with examples?

Q2__ Please mark the following statements if correct ( ) or incorrect ( X ) and write the correct
statement if not correct:

a) STS 0x52E, 0x95 ---------- > i s illegal instruction because .........

b)LDD R16, Z+127 ------------> is illegal instruction because ........

c) STD Z+q, Rr ----------> Store Rrinto the register Z+q

d) The instructions that use 1/O direct addressing mode are IN and OUT:

IN loads data from an 1/0 register into a destination GPR (Rd).

OUT stores data from a source GPR (Rr) into an 1/0 register.

In the above two instructions:

4 bits are used to address the I/O register,

6 bits are used to address the (source or destination) GPR,

5 bits are used for the opcode.

e) The instructions LDS is used in the 1/0 addressing mode, and it contain immediate values.

f) LDI XL, Ox31 ------------ > is the same as "LDI R27, Ox31"

g) The instructions that use data memory indirect addressing mode are 32-bit instructions
h) LDI R20, OxFF

OUT DDRD, R2 ----------> Configure port D as an input port

i) INC R21 --------->Increment R21 with adding carry

Q3__Write instructions that initialize Y register to points to the data memory location 300 (in decimal),
and then:

Load R5 indirectly with the value stored in location 300.

Load R4 indirectly with value stored in location 315.

Q4__Write a program to store the value 0x55 into memory locations 0x140 through 0x144 using:

a) Data memory direct addressing mode.

b)Data memory indirect addressing mode without a loop.

c) loop.

Q5__Write assembly code to store 0x95 into the memory location 0x52E.

Q6__ Write assembly code that loads data from PIN registers of port C and port D into GPRs, perform a
subtraction, and store the result in a destination register.

Q7__ Write assembly code that adds the contents of three continuous locations of data space (0x0200,
0x0201 and 0x0202) and stores the result in the first two locations (0x0200, Ox0201). Firstly initialize the
Z register to point to the memory location Ox0200.

Q8__ Assume that RAM locations 0x90 - 0x94 have a string of ASCHI data, as shown below.

0x90 = ('H') 0x91 = ('E') 0x92 = ('L') 0x93 = (L') 0x94 = (0) Write assembly program to get (read) each
character and send it to Port D; one byte at a time. Show the program using:

a)Data memory direct addressing mode

b)Data memory indirect addressing mode.

c)Data memory indirect addressing mode with post-increment.

Q9__Write a program to clear 16 memory locations starting at data memory address 0x60. Use the
following:

a)Data memory indirect addressing mode (use INC instruction).

b)Data memory indirect addressing with post-increment mode.


Q10__Write a program to copy a block of 5 bytes of data from data memory locations starting at Ox130
to RAM locations starting at Ox60. Use data indirect addressing with post-increment mode.

Q11__Assume that data memory locations 0x240-0x243 have the following hex data

0x240 = (0x7D) 0x241= (0xEB) 0x242 = (0xC5) 0x243 = (0x58)

Write a program to add the contents of theses memory locations and place the result in locations 0x220
and 0x221.

Q12 __Write assembly code to subtract two 16-bit numbers: 0x3512 - Ox2ECA.

Q13__ Write a program to:

-Store the 0x1F2B in the two memory locations 0x15A and 0x15B.

-Subtract an immediate value OxC439 from the contents of locations 0x15A and 0x15B, and then stores
the result in the same locations.

Q14__Write a program to increment the content of data memory location 0x4A6 by 1.

Q15__ Write a program that multiply the two numbers 0x25 and 0x65.

Q16__ write a program to send the value 0xE3 to port D and then toggle this value on port D forever.

Q17__write assembly instructions to mask the upper 4bits of the memory location 0x151 (i.e.4C) and
store the result in the same location.

Q18__write a code to set the bit number of the memory location 0x124 (i.e. 0x18), and store the result
in the memory location 0x25A.

Q19__ Write code that reads a number from port D and compares it to the value OxFA using EOR
instruction. If they are equal the AGAIN loop will be broke. Otherwise, read another number from port D
and repeat the comparison.

Q20__Read and test PORTB to see whether it has the value OxC2. If it does, send OxEE to
PORTC; otherwise, it is cleared

Q21__ Write assembly program that use the zero flag and BRNE to:

A)Clear R17.

B)Add 5 to R17 ten times.

C)Send the result of the addition to PORTD.

Q22 __Write assembly program that:


a)Load PORTC with the value OxA6.

b)Complement PORTC 20 times.

Q23__ write a program that checks continuously a value from the input port B (PINB) until it has a value
other than 0.

Q24 __Write assembly program that find the sum of the values 0x88, OxA4, and OxF3. Put the low byte
of the sum into R18 and the high byte into R19.

Q25__Write a program to determine if SRAM memory location 0x2EF contains O.

If so, store the value 0x2C into the memory location 0x300.

If it isn't equal zero, store the value 0x3F into the memory location 0x300

Q26__ Toggle all the bits of Port B by sending to it the values 0x55 and OxAA continuously. Put a time
delay between each changing of data of Port B

Q27__write assembly program that finds the number of 1s in a given byte (0xC6).

Q28__Follow the instructions below and write the output of each one

LDI R21, 0x44

ORI R21, 0x85

CBI PORTD, 6

SBI PORTC, 2

SEC

LDI R20, 0x95

ROL R20

ROL R20

ROL R20

You might also like