PIC16F877 Simulation Lab

PIC16F877 Simulation Lab — interactive hardware simulator · all special function registers live · type instructions or run full programs

Only PORTA and PORTB are wired to breadboard hardware here (switches and LEDs/7-seg), the same way a first PIC lab bench usually is. PORTC, PORTD and PORTE are still fully live — read/write them from the editor, CLI, or the SFRs tab — they just aren't tied to a physical component in this drawing. Any pin currently configured as an input (dashed ring, once you flip its TRIS bit) can also be clicked directly on the chip body itself.

Logic Analyzer — 4 Channels

Time/div

Name each channel and pick any pin (any port, wired to the breadboard or not) to trace it live — captured instruction-by-instruction while running, so fast toggles aren't missed. Time/div runs from 1 ms down to 1 ns; the drawing is laid out on that real time axis (cycles × Tcy), so zooming in past one instruction's Tcy just shows a held value, same as a real instrument outrunning its sample rate. This panel is global — it keeps running under the Interrupt (RB0/INT) and SFRs & Memory tabs too, not just Breadboard — and Run/Stop here are the same Assemble & Run / Stop controls as the ones next to the code editor, so you never have to leave this view to control the simulation.

How this demo works

• The PIC drives PORTB (RB0–RB7). Each RB pin wires straight into the jumper matrix — click its L dot to route that pin to an LED, or its S dot to route it onto the 7-segment bus (bit0..7 → a,b,c,d,e,f,g,dp).
• Switches are wired to PORTA (RA0–RA5) whenever a pin is configured as an input (TRISA bit = 1) — click to toggle, read with MOVF PORTA,W / BTFSC PORTA,0. Configure an RA pin as an output instead and its switch knob turns yellow, showing the value the CPU is driving, and stops responding to clicks.
• Set TRISB = 0 before writing PORTB, otherwise the pins stay inputs and nothing lights up.
• Bank switching is real, across all four banks. Instructions only carry a 7-bit register offset — PORTA/PORTB (bank 0) and TRISA/TRISB (bank 1) share the same offset, so which one you actually hit depends on the live STATUS<RP1:RP0> bits at that moment, exactly like real hardware. Writing MOVWF TRISB while RP0=0 silently writes PORTB instead — BSF STATUS,RP0 before touching TRISx, then BCF STATUS,RP0 before touching PORTx, exactly as the default program does.
• The currently-executing instruction is highlighted directly in the Program Editor as the program runs.

CPU State

PCWBankZCDC
00x000 000
PORTATRISAPORTBTRISB
0x000x3F 0x000xFF
PORTCPORTDPORTEStack
0x000x000x000/8

      
Clock (Fosc): Tcy = 0.500 µs/instr · up to 2.00 MIPS
Run speed: 1/4 Full Full speed (1×) — real-time-accurate at the selected clock
Instructions: 0  ·  Simulated time: 0.000 ms  ·  Real time: 0.000 ms  ·  Achieved: —