Embedded Software Design (252) : 2 Year - 2 Semester Lab 4
Embedded Software Design (252) : 2 Year - 2 Semester Lab 4
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
Use the following subroutines for setting delay time and counting the delay time interval in your program.
Page 2 of 3
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