Question: 3 Analyzing the elements of a program Example program with line numbers 01 Answer these questions using the example program below. 02 03 ;; Lect

 3 Analyzing the elements of a program Example program with line

3 Analyzing the elements of a program Example program with line numbers 01 Answer these questions using the example program below. 02 03 ;; Lect Exmple01, Add 0x12+ 0x23 + 0x34 and put the result in GPR 0x00 Inputs: none Outputs: none Side effects: result is written into variable 'Result Var! A. Which lines of the example program correspond to the banner comment 04 05 B. Which lines correspond to required header things 06 07 C. In which lines of the program is data space for variables reserved 08 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ;; Required header things, ii PIC-AS requires these to specify the target and special configuration bits in the PIC18 09 D. A processor instruction is a mnemonic that assembles to an Op Code for execution by the CPU. An assemble directive is an instruction to the assembler that does not correspond to any specific Op Code. 10 11 12 PROCESSOR 18F47010 ;directive to define processor #include processor specific variable definitions #include "EE367_PIC18F47010_Setup01.inc (1) Make a list of all processor instructions used in the program. Do not include assembler directives in the list. 13 14 15 (2) Make a list of all assembler directives used in the program. 16 17 PSECT udata_acs ii Begin a memory data section DownCounter: DS 1 ;; Reserve 1 byte of data memory for variable DownCounter UpCounter: DS 1 ;; Reserve 1 byte of data memory for variable UpCounter E. Variables 20 21 (1) Make a list of variables created by the program. 22 23 (2) For each variable, indicate the lines on which the variable is used. 24 i. On which lines is data stored (written to the variable ? 25 ii. On which lines is data read from the variable ? PSECT Code, class=CODE, abs Code: ORG Ox00000 GOTO Main ORG Ox00020 Main: MOVLW 0x05 MOVWF DownCounter CLRE UpCounter Loop: INCE UpCounter, NOP DECE DownCounter, 26 27 ;; 0x05 -> [W] ii [W] -> [DownCounter] ; 0 -> [UpCounter] 28 F. Make a list of symbols defined in the program that correspond to program memory addresses. (Hint: there are three, and program memory addresses correspond to assembly language instructions). 29 ;; [UpCounter] + 1 -> (UpCounter] 30 31 32 G. (Extra credit, 5 points) What are the numerical values of the two symbols identified in question F? (That is, what is the program memory address corresponding to the next instruction following each symbol, recall that most PIC18 instructions are single-word, and the PIC18 instruction word is two bytes.) 33 BNZ Loop i; [DownCounter] - 1 -> [DownCounter] ;; DECF will raise the z flag, if [DownCounter] becomes 0 i; If the Z flag is lowered, branch to Loop If the Z flag is raised, processing continues to the Sleep instr. i Puts CPU in Sleep mode ;; End of program 34 35 36 Sleep END Code H. Is "Sleep a processor instruction or an assembler directive? I. Is "END" a processor instruction or an assembler directive

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!