Pointers and Subroutines

127 views 10:07 am 0 Comments June 8, 2023

12:23
< Back ETEC202LabManual.pdf
1 35 of 93
ETEC202
Tools
• MINAS° X (v1.90 or higher) • MPLAB° XC16 (v1.10 or h■gher,
Lab 4 Pointers and Subroutines
Purpose This lab has you convert a C program that uses pointers and subroutines into PIC24 assembly language. The C programs are provided as MPLAB projects.
Objective
Upon completion of this lab, students will have demonstrated the ability to:
• Translate C code with indexed addressing into P.4 instructions. • Translate C subroutines into PIC24 instruction using static and register allocation for parameters. • Translate C subroutines using stack frame policies for parameters.
4-1
ETEC202 Microcontrollers 1
raPreLab IhrUcPt:t7Echtsk :cPi:t’u)nt:LPP:hda:);fo°u7::trc:il:ttc1)::lb7g” bYthe
1. Unzip the archive containing the lab. 2. Have your assigned C program compiled, and bc able to demo its execution to the instructor (See the TASK 4-1 below for your assigned C program). 3. Have an MPLAB project and assembly language program written for your assigned task. Your assembly language program should initialize the contents of sz_l, sz_2 from program memory by calling init_variables as is done in mplab/upcase_asmversion.s (use the constant strings that you find in your assigned C program). Execute this program and demonstrate to the instructor the first place where it does not agree with thc C program. 4. Please go through the lecture slides for Chapter 6: Pointers and Subroutines