Explain the memory organization of a processor PIC18xx2Data

Explain the memory organization of a processor PIC18xx2(Data and Program), how the data is accessed
Explain the memory organization of a processor PIC18xx2(Data and Program), how the data is accessed

Solution

The design of our stored machine begins with determining what type of instructions it should execute, and the format or binary encoding of these instructions. To determine this we will describe the task as a sequence of statements

START;

if (loc) goto LOCAL

dout = 3;

dout = 2;

dout = 4;

LOCAL;

dout = 8;

dout = 5;

dout = 6;

dout = 1;

goto START;

These statements represent three distinct operations;

An output operation as specefied by the statement dout = 2, which places the value 0b0010 on the DOUT data bus.

An unconditional transfer of control, also known as a goto or jump, as specified by the statement goto START, which says to fetch the next instruction from the memory location represented by the label START.

A coinditional transfer of control, also known as a branch or jump, as specified by the statement if (loc) goto LOCAL. If loc is nonzero (i e true ) the next instruction fetched that one at label LOCAL. If loc is zero ( i e false ), the next sequential instruction in memory is fetched, which is dout = 3.

The PIC18 assembly language of program is some what obtuse because memory location values (0x000, 0x001, 0x002) are used insted of the variable names i,j,k. Also, there is still the program of translating the PIC, instruction mnemonics to machine code, a process that is interesting the first time, boring the secnd time, and painful there after. Ap rogram called an assembler automatically converts instruction mnemonics to machine code. Microchip Technology provides an Integrated Design Environment called MPLAB which contains an assembler and simjlator for most Microchip microprocessors.

INCLUDE \"p18f22.inc\"

CBLOCK 0x000

i, j, k

ENDC

avalue equ D\'100\'

org 0

goto main; reserve 0x0-0x1FF for interrupts

org 0x0200

main

; I= avalue;

movlw avalue ; w <-- 100

movwf i ; i<---( w);

; i - i + 1;

incf i, f ; i <--- ( i ) + 1

: j = i

movf i, w ; w <-- ( i )

movf j : j <-- (w)

: j + j -1;

dexf j, f ; j <-- ( j ) - 1

: k = j + i

movf I, w ; w < ---- ( i )

addwr j, w ; w <---- ( w ) + ( j )

movwr k ; k <---- ( w )

here

goto here : loop forever

end

The Include statement in line 1 is called an assembler directive, which is an instruction to the assembler and not a PIC18 assembly language statement.

Verify that the final value of k contains the expected value of 0xC9 when the goto here statement is reached.

Change the value of th avalue symbol to be the decimal equivalent of the last two digits of your student ID. If the last two digits of your student Id are 00 use the first two digits. compute the new expected value of k when the goto here statement is reached; verify this value by assembling and simulating the program. Capture the screen shot that show the program memory and file register contents when the goto here statements is reached.

Modify the file so that the CBLOCK starting location is 0x80 Re assemble and re execute the program. Verify that the i,j,k variables are updated at location 0x80-0x82.The instuction program location 0x202 is now different form the original file. record this defference and determine the reason for this behavior.

Modify the file so that the CBLOCK starting location is 0x100 Reassemble and re execute the program. Use the file registers window to determine what locations ar changed when the i,j,k variables ar modified. Record these locations and determine the reason for this behavior.

 Explain the memory organization of a processor PIC18xx2(Data and Program), how the data is accessed Explain the memory organization of a processor PIC18xx2(Dat
 Explain the memory organization of a processor PIC18xx2(Data and Program), how the data is accessed Explain the memory organization of a processor PIC18xx2(Dat

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site