Lab Procedure Task

158 views 10:06 am 0 Comments June 8, 2023

12:23
< Back ETEC202Lablvlanual.pdf
a. IOn
Microcontrollers 1 rjin-Lab Procedure Task 1:
Unzip the ZIP archive conwhning the lab. You will see three directories (folders) la-beled strdease, strfip, and strxchg. If the last digit o(your Centennial student ID is:
ETLC202
• 0,1,2 then use strdcase (copies psz, to psz downcases letters) • 3,4,5 then use strflip (copies pszl to psz_2—with pm, getting flipped case version of pszl) • 6,7,8,9 then use struhg (exchanges pal, psz_2 with psz I getting the Flipped case version of psz2 )
Each directory contains an MPLAB project file and C source file. Each C source file has a main that calls a subroutine named void doss … pszl, ch.. p._2) that wk. two pointers to null-tominated strings and per.ms some action on the two strings (i1 may either copy …change the contents of the strings and chuge the cam of one of the string). The main function prints the values of the strings before and after the dostr function is call.. You can compile and run the program to see how the strings …fluted by the subroutine.
Your task is to manually convert your .signed C program to PIC24 assembly language (without the print statements, aeon.). When you call the d.tr fitution in assembly, you must pass the pszl, psz 2 parameters in WO, WI as per our subroutine calling .1.. Use the MPLAB project named mplabh,peaseasmversion.mcp as a starting template for your project, as it initializes two strings in SRAM named szl sz_2 from strings named sz_l_const, sz_2_const residing in program memory. You will need to change the values of sz_l_const, sz_2_const to match the string constants in your assigned C program.
The printf statements arc in the C source only for debugging purposes; they arc not implemented in the PIC24 assembly program. Your PIC24 assembly program should have the same values for the strings when main is finished as the values printed by the original C program.
Instructor Signoff Show the instructor that the final values of the strings in your assembly language program match the final values produced by the C program.
Assignment 4-1:
I. Take a …hot of the final values of the stings in program memory after your program has exe-cuted. Include your program source code in your lab submission
4-3
ETEC202 Microcontrollers 1
Task 2:
The MPLAB project named mplab/upcase_eversion.X uses the PIC24 C compiler to compile the C file um. upease_cursion.c. This C file contains a function named upcase(char l.psz_1) that upcases all characters in the null-terminated string pszl. The main code calls unease with two dif-ferent strings, sz, and sz_2. Your go:61,011…g the video:
• Watch as the szl and sz2 strings are initialized by copying them from program memory to data memory by the _datzinitextended subroutine. • Watch as the unease subroutine changes the cause of .1 and sz2. • Locate the area in program memory which emu.ns the initial values for and sz_2 (not shown in the video). Include this in your report.
Instructor Signoff Show the instructor that the final values of the strings in data memory after the main has executed, and also show the instructor where the constant strings used to initialize szl and sz2 reside in pro-gram memory. Assignment 4-2:
Include the two screensho. you took as well as a description of where the constant values used to initialize szl and sz_2 reside in program memory in relation to main.