Your First Simulation in PICSimLab: From Install to a Blinking LED
This walkthrough takes you from a fresh install to a running simulation with a visible result: an LED switching on and off. It uses the best-documented combination in PICSimLab — a PIC16F877A on the McLab2 board — and the built-in example route, so you do not need to write or compile any code for your first run. Once this works, every other tutorial on this site follows the same flow.
What you need
- PICSimLab 0.9.3 installed — follow the Windows install guide (or the download page for Linux and macOS). No compiler is needed for this first run; compiling your own code comes in the workflow guides linked at the end.
- About ten minutes. Nothing else: the example firmware ships with PICSimLab.
No install possible right now? The online version runs the same simulator in a browser tab with documented limits (no debugging, no serial, about half desktop speed) — the steps below for selecting a board and loading an example are the same idea, with files loaded by drag and drop or the Load button.
Step 1: Start PICSimLab and select the board
Launch PICSimLab. Select the McLab2 board and set the microcontroller to PIC16F877A. Board selection comes first in every PICSimLab session: the board defines which microcontrollers you can pick and how the firmware you load will be interpreted. McLab2 officially supports the PIC16F877A (along with the PIC16F777, PIC18F452, PIC18F4520, PIC18F4550 and PIC18F4620); the PICGenios board supports the same set if you prefer it.
Step 2: Open a built-in example
Open the examples from the Help → Examples menu and choose an McLab2 example written for the PIC16F877A — a blink or LED example is ideal for a first run. The examples are the fastest way to reach a known-good simulation, because the firmware, board and microcontroller already match. Alternatively, if you have already compiled a project, load your own firmware instead — the hex loading guide covers that path.
Step 3: Run the simulation
Start the simulation with the run control. A working example shows immediate life: board LEDs change state, and the simulated clock starts counting. If absolutely nothing happens, do not guess — work through the simulation not running checklist (run state, reset, clock and workspace checks) before changing anything else.
Step 4: Add an LED spare part and watch a pin
Board LEDs are fixed to the board. To watch a pin of your choosing, add a spare part:
- Open Modules → Spare parts.
- From the Outputs category, add LEDs (a bank of 8 red LEDs).
- Right-click the part, open Properties, and connect the first LED to the pin your example toggles (for a typical blink example, check which port pin the example drives — RB0 is a common choice).
- Run the simulation again and watch the LED follow the pin. Right-clicking any spare part also gives you Move, Rotate, Delete and Help.
You have now used the three building blocks of every PICSimLab session: a board, a firmware file and spare parts wired in Properties. The dedicated LED and push button spare parts tutorial goes further, and the PIC16F877A LED blink tutorial shows the same blink written and compiled by you, end to end.
Step 5: Stop, reset, experiment
Stop the simulation, change one thing — a different example, a different LED pin in Properties, a push button part wired to an input pin — and run again. Small, reversible experiments are how the spare-parts system clicks. When you are ready to run your own code, continue with the workflow that matches your chip family: MPLAB X + XC8 for PIC or PlatformIO / Arduino IDE for AVR, STM32 and ESP32. The full beginner path is collected on the getting started page.
