Mplab
1. First download both MPLAB and C18 and install them into the default directories (see www.microdigitaled.com for instructions). 2. After you have finished the above step, openMPLAB.
Go to Menu->Project->Project Wizard.
Page 1 of 13
MPLAB Tutorial
Hit Next to bypass the Welcome screen and select the PIC processor for the project and hit Next.
Select the MicrochipC18 Toolsuite and hit Next (This assumes C18 was installed previously).
Page 2 of 13
MPLAB Tutorial
Give the project a name and directory and hit Next.
Hit OK to create directory, if needed.Page 3 of 13
MPLAB Tutorial
Find the C18 lkr directory, usually C:\MCC18\lkr\18f458i.lkr, Hit Add>> and check box.
Hit Next and then hit Finish.
Page 4 of 13
MPLAB Tutorial
Go toMenu->Project->Add New File to Project.
Browse and find your project directory. To use MPLAB for an Assembly program, save a file with the .asm extension. MPLAB will open the file.
Page 5 of 13MPLAB Tutorial
Now you can type your Assembly code or insert the Assembly code into the file.
The ORG value is already set by the linker, however, if you want to compile the program for adifferent PIC.processor you must copy and insert the new value for ORG which is found in the .lkr file.
Page 6 of 13
MPLAB Tutorial
Click the Build Toolbar button to compile.
To simulate yourprogram go to Menu->Debug->Select Tool->3 MPLAB SIM.
Page 7 of 13
MPLAB Tutorial
To view the registers and variables Go to Menu->View->Watch.
Select PORTB and PORTD and hit Add SFR.
Page 8of 13
MPLAB Tutorial
1. To single step click on the icon on the Debug Toolbar. 2. To set a breakpoint on Line 11 right-click on the line and select Set Breakpoint.
Debug Toolbar
Hit the RunToolbar button several times and observe the values changing in Watch.
Page 9 of 13
MPLAB Tutorial
To use MPLAB for a C program, right-click on the .asm file in the project and select...
Regístrate para leer el documento completo.