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

Embedded Software Design (252) : 2 Year - 2 Semester Lab 4

This document provides instructions for three exercises in an assembly language lab. The first exercise asks students to write a program to convert the string "sliit" to "SLIIT" by storing each character in a register and converting it to uppercase. The second exercise asks students to write a program to count the number of bits set in a given data location and save the count to another location. The third exercise asks students to generate a blinking LED pattern using an array of 8 LEDs that alternates between odd and even LEDs being on every 100ms.

Uploaded by

Gamindu Udayanga
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Embedded Software Design (252) : 2 Year - 2 Semester Lab 4

This document provides instructions for three exercises in an assembly language lab. The first exercise asks students to write a program to convert the string "sliit" to "SLIIT" by storing each character in a register and converting it to uppercase. The second exercise asks students to write a program to count the number of bits set in a given data location and save the count to another location. The third exercise asks students to generate a blinking LED pattern using an array of 8 LEDs that alternates between odd and even LEDs being on every 100ms.

Uploaded by

Gamindu Udayanga
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Embedded Software Design (252)

B.Sc. Special Honours Degree in Information Technology (Computer Systems & Networking)

2nd Year - 2nd Semester Lab 4 In this lab you have to write some assembly programs according to the instructions given in below exercises. Use MPLAB IDE. Create separate projects to each exercise. You should use the MPLAB SIM (Debugger -> Select Tool -> MPLAB SIM) for simulating your programs. Show the outcomes of your programs using watch windows (View -> Watch).

EXERCISE 1
Write an assembly program that can convert the string sliit in to the string SLIIT. You can use the hex or decimal equivalents given, for representing characters in your program. Store each character in a separate General Purpose Register. Use h20, h21, h22, h23 and h24 for this. You should store the converted characters in the same GPRs First store the characters of initial string in specified registers one by one Then your program should wait for some time. Use the given subroutines for measuring the delay. You have to call these subroutines in your program. Then convert each character to uppercase. You can observe the contents of the registers as characters in a watch window. Right click on table headers in watch window and select char option to show the register contents as characters.

Page 1 of 3

Given below are the decimal and hex equivalents for the characters used in this exercise

Character I L S T i l s t

Hex 49 4C 53 54 69 6C 73 74

decimal 73 76 83 84 105 108 115 116

Use the following subroutines for setting delay time and counting the delay time interval in your program.

set_delay_time movlw d'10' movwf count return ;delay time

Page 2 of 3

delay decfsz count,1 goto delay return

EXERCISE 2
Write an assembly program which will count the number of bits set in file location h20 named DATA and save the count in file h21 which is named COUNT. You should pass some literal value to the register DATA at the beginning of the program. Verify the accuracy of your program by changing the above literal value and observing the value in COUNT several times.

EXERCISE 3
Write an assembly program that generates the LED pattern described below. Pattern works on an array of 8 LEDs. a) Initially all the odd numbered LEDs are ON. b) After 100ms odd LEDs are turned OFF and even LEDs are turned ON. c) 100ms later the pattern switches back to odd LEDs. d) Go to step b Note: 100 ms delay need not to be accurate at this stage. Use the delay subroutine given for the exercise 1 and simulate the output in PIC Simulator IDE.

Page 3 of 3

You might also like