Skip to content

MPLAB v8, MPLAB X, Proteus, and board

So far you learned what to write in assembly (MPASM), how the configuration word works (config bits), and the PIC minimum system. This page closes Foundations: which tools you use to build, simulate, and test in the UNEXPO course.

The academic workflow focuses on MPLAB v8 + MPASM + Proteus. You will also see MPLAB X so you recognize the modern IDE on another machine.

Reports and labs mix three names. Keep them separate:

ToolWhat it isCourse role
MPLAB v8 / XIDE — development environmentEdit .ASM, create project, run build, program with PICkit
MPASMAssemblerTranslates .ASM.HEX (program + configuration word)
Proteus ISISSimulatorRuns .HEX in a virtual circuit — does not compile
PICkit / programmerBurnerWrites .HEX to real PIC Flash

MPLAB is not the assembler. MPLAB is the workspace; when you click Build, MPLAB calls MPASM for you.

Create a PIC18F4550 project and edit source using the sandwich layout: LIST, #include, CONFIG, ORG, subroutines, programa: at the bottom.

The file on disk is plain text (.ASM / .asm). MPLAB saves and highlights it — there is no .HEX yet.

Project → Build All invokes MPASM. If there are no errors, you get the .HEX:

your_program.ASM
↓ MPASM (from MPLAB)
your_program.HEX ← Flash program + config bits
your_program.COD ← listing (optional, debug)

If END is missing, a symbol lacks #include, or a label is wrong, the build failsdo not simulate until you fix the Output window.

Wire the minimum system + LED, load the same .HEX into the virtual PIC, and press Play. Proteus interprets .HEX bytes; it does not read your .ASM directly.

With the same .HEX (rebuilt if you changed code), connect PICkit, Program in MPLAB, and validate the LED or peripheral on the breadboard.

The .HEX is the bridge between software and hardware. It is not readable .ASM — Intel HEX format with two conceptual blocks:

.HEX contentSource in your .ASMDestination
Program (instructions)ORG, GOTO, MOVLW, BSFExecutable Flash
Configuration wordCONFIG directivesConfig memory (startup)

One file feeds Proteus and the programmer: both need program and config bits matching the 20 MHz crystal and course template.

MPLAB editor (.ASM)
↓ Build / assemble
MPASM → .HEX file (+ optional .cod)
┌────────────────┴────────────────┐
↓ ↓
Proteus (simulation) PICkit / programmer
↓ ↓
Virtual LED, logic pins UNEXPO physical board
StageToolInputOutput
WriteMPLAB v8 / XYour source code.ASM
AssembleMPASM.ASM.HEX (program + config bits)
SimulateProteus ISIS.HEX + schematicVirtual behavior
ProgramPICkit 2/3, etc..HEXPIC18F4550 Flash

Full walkthrough — minimal example (First LED)

Section titled “Full walkthrough — minimal example (First LED)”

Suppose you turn on RB0. The full flow:

1. Source in MPLAB — minimal fragment (see Assembly — LED):

LIST P=18F4550
#include <P18F4550.INC>
CONFIG FOSC = HS, WDT = OFF, LVP = OFF, PBADEN = OFF
ORG 0x0000
GOTO programa ; jump to main
programa:
BCF TRISB, 0
BSF LATB, 0
loop:
GOTO loop ; jump → destination loop: (above)
END

2. Build in MPLABproject.hex appears with no errors in Output.

3. Proteus — PIC18F4550 + 20 MHz crystal + LED on RB0 → Program File = that .HEXClock Frequency = 20 MHzPlay.

4. Board — same .HEX, PICkit, Program → LED on if wiring and config bits match.

If you change one .ASM line, go back to step 2 before Proteus or the board. An old .HEX is the #1 cause of “simulation does not show my change”.

MPASM reads your assembly file and:

  1. Translates mnemonics (MOVLW, BSF…) into machine code.
  2. Resolves labels, #include symbols, and CONFIG directives.
  3. Generates the .HEX for programmer or Proteus.
  4. Reports errors if END is missing, labels duplicate, or symbols are undefined.
FilePurpose
.HEXLoad into Proteus or programmer — the important one
.CODListing with addresses and machine code (debug)
.LSTSource mixed with listing (if enabled)
.ERRAssembly errors (if build fails)

If the build fails, there is no useful .HEX — fix errors in the output window before simulating.

Output messageCommon causeReview
Symbol not definedMissing #include <P18F4550.INC> or typo (TRISB)Assembly — directives
Label requiredLabel without : (programa vs programa:)Labels
END directive requiredMissing END at endSandwich layout
Bank select errorVariable in another bank without BSRRegisters — banks
Argument out of rangeLiteral outside 0–255Literals

MPLAB v8 project — what the wizard creates

Section titled “MPLAB v8 project — what the wizard creates”

The Project Wizard does not write code for you; it organizes files and tells MPASM which MCU and tool to use:

Project elementFunction
PIC18F4550 deviceMPASM generates correct opcodes for that chip
MPASM toolchainNot XC8 if the course is pure assembly
Added .asm fileSource you build
Project folderWhere .HEX appears after Build All

After building, find the .HEX in the project folder (sometimes Debug/, sometimes root). That path is what you load in Proteus → Program File.

MPLAB v8 is Microchip’s classic IDE. UNEXPO labs often use it because it fits MPASM and pure .ASM projects well.

  1. Project → Project Wizard
  2. Select PIC18F4550
  3. Tool: MPASM (not XC8 if you only use assembly)
  4. Project name and folder
  5. Add your .asm file to the project
  1. Project → Build All (or hammer icon)
  2. Check Output — should say Build succeeded
  3. Find the .hex in the project folder (e.g. Debug/ or root)

You can edit them via Configure → Configuration Bits, but in the course it is better to declare them in .ASM (config bits) so report and .HEX match.

MessageCommon cause
Symbol not definedMissing #include <P18F4550.INC> or typo in TRISB
Label requiredLabel without : (start vs start:)
END directive requiredMissing END at file end
Bank select errorVariable in another bank without correct BSR

MPLAB vs Proteus vs board — who does what

Section titled “MPLAB vs Proteus vs board — who does what”
TaskMPLAB + MPASMProteusPhysical board
Write code
Build .HEX
Simulate without hardware
Real crystal timingApproximate
Noise, contacts, bounceLimited
Program PIC FlashWith programmerSimulates only

Course rule: build without errors first, then simulate in Proteus, then breadboard.

Before saying “it does not work”, verify everything matches:

  • Device: PIC18F4550 in MPLAB, Proteus, and board
  • CONFIG FOSC = HS and 20 MHz crystal in schematic and Proteus
  • Same .HEX in Proteus and programmer (rebuild after every change)
  • PBADEN = OFF, LVP = OFF, WDT = OFF (course template)
  • LED pin matches code (RB0BCF TRISB,0 and BSF LATB,0)
  • Rebuilt after editing .ASM

Ejercicio · Parcial

Order the workflow

Correct order for the First LED practice:

  1. Write .ASM with LIST, #include, CONFIG, ORG, GPIO code
  2. Build in MPLAB → get .HEX
  3. Build schematic in Proteus with 20 MHz crystal
  4. Load .HEX into Proteus PIC
  5. Simulate and verify LED
  6. Breadboard and program with PICkit

Typical mistake: loading an old .HEX in Proteus after changing code without rebuilding — simulation does not reflect your latest changes.

  • Proteus without loaded .HEX: PIC simulates empty memory or old program.
  • Proteus clock not 20 MHz: timing and some peripherals won’t match the board.
  • Mixing MPLAB X and v8 projects: conflicting paths and toolchains.
  • Simulation OK, board not: check supply, MCLR, crystal, PIC orientation, LVP/PBADEN.
  • Board OK, simulation not: outdated .HEX or wrong Proteus frequency.
  • Treating Proteus as compiler: Proteus does not replace MPASM — it only runs .HEX.

What is the difference between MPLAB and MPASM?

MPLAB is the environment (editor, project, programmer). MPASM is the assembler that translates .ASM.HEX when you Build.

What file does MPASM produce on a successful build?

A .HEX file with program and config bits for programming or simulation.

What is Proteus used for in the course?

To simulate circuit and program before the physical board, loading the .HEX from MPLAB.

Does MPLAB assemble directly or use another tool?

MPLAB invokes MPASM (for pure assembly projects in the course).

Why must Proteus clock frequency match the crystal?

Execution time and peripherals depend on Fosc; with FOSC = HS and 20 MHz crystal, Proteus should use 20 MHz.

Interactive exam

MPLAB and Proteus

0 of 0 answered

In the course workflow, Proteus is mainly used to...
MPASM mainly produces a...
The correct academic workflow order is...
In Proteus, the PIC clock frequency should match...
Proteus CANNOT...
In course MPLAB v8, the assembly tool is...
If you change .ASM but do not rebuild, in Proteus...
To program the UNEXPO physical board you use the same...
Simulation OK but board fails — check first...
The .HEX also contains besides the program...
MPLAB v8 by itself...
You change one .ASM line but do not rebuild. In Proteus...