Exp 5

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Experiment No.

Aim: Program to transfer data bytes from program memory to data memory.

 Program Statement:
Write a program to copy following five data bytes stored in program memory with the
starting location 000050H called source to the data register labeled as buffer with the
beginning address 0010H. When the copying process is complete ,indicate the
completion by turning ON all LEDs at port c.
Data Bytes : 0xf6,0x67,0x7f,0xa9 and 0x72

 Software :
MPLAB IDEv8.5

 Procedure:
1. Choose Configure>select Device. In the device dialog ,select PIC18F8720 from the list.
2. Choose Project>Project Wizard.
From the Welcome dialog, click on Next>to advance.
3. Step 2 of the Project Wizard sets up the language tools that are used with this project.
Select “Microchip MPASM Tool suite” in the Active Tool suite list box.
4. Step Three of the wizard allows you to name new project and put it into a folder.
5. Select the template file and add it to project
C:\Progarm Files\Microchip\MPASMsuite\Template\Object\18F8720TMPO.asm. Press
Add>to move the file name to the right panel. Click on the “A” at the start of the line
with the file name three times until a “C” appears . this will enable this file to be copied
to our project directory.
6. Open the template file in the project by double clicking on its name in the Project
window.
7. Type the program and variables need to be defined is added in the UDATA_ACS section
for uninitialized data using Access RAM
8. Select Project>Build All to assemble and link the code.
9. Select MPLAB SIM simulator as the debug execution tool. This is done from the
Debugger>Select Tool pull down menu.
10. Select File>Save Workspace to save the Project.
11. Select Debugger>Reset>Processor Reset and a green arrow shows where the program
will begin. This was part of the template file. The first instruction in memory jumps to the
label called Main, where your code was inserted.
12. Press the Step into icon or select Debugger>step Into to single step to the code at Main
or Start.
13. Select View>Watch and add SFRs and SYMBOLs to be watched.
14. Select View> File Registers to watch the locations in the data file.

 Conclusion:

Department of Electrical Engineering, Viva tech Prof. Ashwini Haryan


Experiment No.5

 Program:

;Program for data transfer


#include<p18F8720.inc>
BUFFER EQU 0X10
COUNTER EQU 0X01
ORG 0X00
GOTO START

START MOVLW 0X00


MOVWF TRISC
MOVLW 0X05
MOVWF COUNTER
LFSR FSR0,BUFFER
MOVLW UPPER SOURCE
MOVWF TBLPTRU
MOVLW HIGH SOURCE
MOVWF TBLPTRH
MOVLW LOW SOURCE
MOVWF TBLPTRL
UP TBLRD*+
MOVF TABLAT,W,A
MOVWF POSTINC0
DECF COUNTER,F,A
BNZ UP
MOVLW 0XFF
MOVWF PORTC

ORG 0X50
SOURCE DB 0XF6,0X67,0X7F,0XA9,0X72
END

Department of Electrical Engineering, Viva tech Prof. Ashwini Haryan


Experiment No.5

 Result:

Department of Electrical Engineering, Viva tech Prof. Ashwini Haryan

You might also like