0% found this document useful (0 votes)
4 views16 pages

Part C Unit 3 MPMC

The document outlines various programming tasks for microcontrollers, specifically focusing on assembly language for the Intel 8085 and 8051 architectures. It includes detailed instructions for transferring a string from ROM to RAM, manipulating bits in an 8-bit value, and various operations related to timers, ports, and serial communication. Additionally, it discusses interrupts and provides examples of programs for specific functionalities such as LED control and serial communication.

Uploaded by

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

Part C Unit 3 MPMC

The document outlines various programming tasks for microcontrollers, specifically focusing on assembly language for the Intel 8085 and 8051 architectures. It includes detailed instructions for transferring a string from ROM to RAM, manipulating bits in an 8-bit value, and various operations related to timers, ports, and serial communication. Additionally, it discusses interrupts and provides examples of programs for specific functionalities such as LED control and serial communication.

Uploaded by

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

Part c unit 3

1. Assuming that ROM space starting at 250H contains “America”, create a program to
transfer the bytes into RAM locations starting at 40H.(12m)

To transfer the bytes of the string "America" from ROM space starting at memory address
250H to RAM starting at memory address 40H, you can write a program using assembly
language for a microprocessor like the Intel 8085 (or similar architecture). The steps would
include loading the data from ROM into registers and then storing it in the corresponding
locations in RAM.

Assuming you're working with an 8-bit microprocessor and the string "America" is stored in
ROM starting at address 250H, here’s a simple assembly program to accomplish this:

Assumptions:

 The ROM starting address is 250H.

 The RAM starting address is 40H.

 The string "America" is null-terminated, meaning it ends with 00H.

Explanation:

 ORG 0H: This directive tells the assembler to start the program at memory address
0H.
 MVI D, 40H: This instruction initializes register D with the starting RAM address
(40H).

 MVI E, 250H: This instruction initializes register E with the starting ROM address
(250H).

 TRANSFER Loop:

o MOV A, M: Loads the byte from the ROM (pointed by the address in register
E) into the accumulator.

o MOV M, A: Stores the byte from the accumulator into the RAM (pointed by
the address in register D).

o INX D: Increments the RAM address (register D).

o INX E: Increments the ROM address (register E).

o MOV A, M and ORA A: Checks if the byte is 00H (null terminator), in which
case the loop ends.

o JZ DONE: If the byte is 00H, the program jumps to the DONE label.

 DONE: The program halts once all bytes are transferred.

  The string "America" consists of the following bytes in ASCII:


A = 41H m = 6DH e = 65H r = 72H i = 69H c = 63H a = 61H
Null terminator = 00H
  This program will transfer the bytes "America" from ROM address 250H to RAM
starting at address 40H.

2 Construct a program for an 8051 microcontroller that sets, masks, and adds the 2's
complement to an 8-bit value.(12m)

To construct a program for the 8051 microcontroller that sets, masks, and adds the 2's
complement to an 8-bit value, we can break it down into the following steps:

1. Set a specific bit in the 8-bit value (set a 1 in a particular position).

2. Mask a bit (clear a bit at a specific position).

3. Add the 2's complement of the value.

8051 Assembly Program Overview

The 8051 microcontroller operates with an 8-bit accumulator (A), so we will work
primarily with the accumulator and other registers for manipulation. The steps
involved are:

1. Set a bit in the 8-bit number.


2. Mask a bit (clear a bit).

3. 2's complement (invert the bits and add 1).

4. Add the 2's complement to the original value.

Explanation:

1. Set a bit:

o The instruction SETB 7 sets bit 7 of the accumulator A to 1. This modifies the
accumulator from 01111111 to 11111111.

2. Mask a bit:

o The instruction CLR 3 clears bit 3 of the accumulator, modifying the value
from 11111111 to 11110111.

3. 2's complement:
o The instruction CPL A inverts all the bits of the accumulator (complement),
turning 11110111 into 00001000.

o The instruction INC A adds 1 to the value in the accumulator, turning


00001000 into 00001001. This is the 2's complement of the original value.

4. Add the 2's complement:

o Finally, the instruction ADD A, #0x7F adds 0x7F (which is 01111111 in binary)
to the accumulator, which contains the 2's complement value. The result is
stored back in the accumulator.

3. Interpret the modes of operations in 8051 timer, with suitable diagram (12m)
4. Discuss the functions of 8051's ports and circuitry with necessary diagram(12m)
5. Illustrate the serial communication modes in 8051. Depicts the format SCON and PCON
register.(12m)
6. Create a program to transmit the character string "HELLO" to a serial port. Configure the
baud rate to 9600 with an 8-bit data and 1-bit stop.(12)

7. . Assume two switches are connected to pins P3.2 and P3.3, when a switch is pressed the
corresponding lines goes low. Create a program to (i) light all LEDs connected to port 0, if the
first switched is pressed. (ii) light all LEDs connected to port2 , if the second switch is
pressed(12)
8.Discuss role interrupts the in 8051 . Depicts the format IE and IP register.(12)
9 Create code to (a) deliver the message "We are ready" to the Computer. (b) take in any
information supplied by the PC and display it on the P1-connected LEDs. (c) gather
information from switches linked to P2 and send it serially to the PC. Use the 4800 Baud rate
10. Assume XTAL= 11.0952 MHz, determine the value need to be loaded in the timer
register, if the delay is 5ms. Develop the program using 8051 microcontroller to create a
pulse width of 5ms on P2.3 . Use Timer 0(12m)

You might also like