PROCEDURE TO USE MPLAB SIM The first step is to install MPLAB SIM software in your PC, then create a new

sub-directory in the main directory RT. For example, in order to write a program to do mathematical addition, create a sub directory called add8 (just a name) in the main directory RT. Create a new directory in E drive in your name, say RT for every program Similarly, to write any program, create a new sub-directory with suitable name in the main directory RT. While assembling the program, MPLAB will create several files with name extensions like LST, HEX, ERR etc in the same sub-directory. 1) Double click the MPLAB icon on desktop. The screen will appear as shown below

2) 3) 4)

In the tool bar, select Project. Drop down menu will appear Select new project.

The screen will appear as shown below

A drop-down menu will appear Select New.5) In the project directory form space. the screen will appear as below 9) 10) Type your program in the window The screen will appear as shown below 11) Save your program with the same name and in the same sub directory. and then select assembler. type E:/ RT / add8. . Similarly in the project name type the same name add8 6) 7) 8) From the tool bar select File.

the file name which you just saved will appear. below the source file. select Build all to assemble the file. From the drop down menu. 14) In the left hand side of the screen. The screen will appear as shown below 15) 16) Click on Project from the tool bar. 17) If there is no error. From the drop down menu. Otherwise the number and types of errors occurred will appear in the window as shown below 18) 19) 20) Select Configure from the tool bar. From the drop-down menu select Device From the new window select the device 16F877 and say OK . select Add file to project.12) 13) Now click on Project on the tool bar. Build succeeded will appear.

displaying the content of file registers and SFR.21) 22) 23) 24) 25) This is to select the appropriate SFRs for the selected device. The screen will appear as shown below 29) 30) Select Window from the tool bar Select tile horizontally option The screen will appear as shown below . Select View from the tool bar 26) select File Registers from the drop down menu 27) Select Special Function Registers from the same drop down menu 28) Two new windows will appear. Select Debugger from the tool bar Select Select Tool from the drop down menu Select MPSIM from the sub menu.

. A window will appear as shown in the figure below Click Load HEX file.exe file on the desktop. Repeatedly press F7 to execute other instructions. Check file registers and Special Function Registers to verify the result of executing each instructions till the end of the program.31) Select Debugger from the tool bar 32) select Reset from the drop down menu 33) Select Processor Reset from the sub menu Now press the key F7 to execute one instruction in the program in a single step mode of operation. Select and double click on PICFlash2. After assembling the program. then select the required HEX file from the sub-directory Click on Oscillator and select option XT. the MPLAB generates other files in the same sub-directory.hex is needed to be downloaded into the kit using any serial software. connect the kit in USB mode with the computer. The add8. For downloading your HEX file into the kit.

Click on WRITE option in the PICFlash2 programmer window for downloading your hex file. Now the hex file gets down-loaded into the kit. . Press RESET key in the kit to execute the program and the see/observe the result.

Sign up to vote on this title
UsefulNot useful