PIC18 Simulator (PIC18F4550 Web Simulator)
Free online PIC18 simulator for PIC18F4550. Browser-based microcontroller simulation with assembler, CPU core, GPIO, UART, ADC, I2C, PWM, and virtual hardware board.
How it works
The PIC18F4550 Web Simulator is a fully-featured, browser-based PIC 18 simulator built so students and hobbyists can get real hands-on practice without needing to buy a physical PICkit programmer or development board. Whether you are looking for a PIC simulation environment or searching for a "pic 28 simulator online" (a common typo for PIC18!), this tool provides complete microcontroller simulation. Just open the page, write assembly code, hit Assemble, and watch the LEDs blink in real time!
How to Use the Simulator
- Load or Write Code: Select one of the 8 pre-made examples (blink, button-to-LED, counter, UART echo, ADC read, LED PWM fade, I2C EEPROM test, multiply demo) from the Load Example dropdown, or write your own PIC18 assembly directly in the editor.
- Assemble: Click the blue Assemble button. A two-pass PIC18 assembler will compile your code and show any syntax errors in the console logs beneath the editor.
- Configure Board Hardware: Add LEDs (red/green/yellow), push buttons (active-low), or analog temperature sensors (ADC-mapped slider) using the palette buttons. Attach them to specific target pins (e.g., RB0, RC2, RA0).
- Run or Step: Click Run to execute code continuously, adjusting the speed slider to observe operations. Click Step to manually execute one instruction at a time, or click a line number in the editor to toggle a Breakpoint.
- Debug with Instruments: Use the Oscilloscope and Logic Analyzer to monitor target pins (e.g., RC2 for PWM duty cycle, RC3/RC4 for I2C SCL/SDA). Send ASCII/Hex data via the UART Terminal, and watch the CPU Registers (W, PC, STATUS, BSR) and Memory viewer update live!
Key Features & Modeled Peripherals
- Assembler: Two-pass PIC18 assembler covering a solid chunk of the real 75-instruction PIC18 ISA, including literal ops, byte ops, bit ops, compare-skip, MOVFF, LFSR, rotate/shift, relative branches, and 11-bit/17-bit addressing.
- CPU Core: Full register file (W, PC, BSR, STATUS, PROD, FSR0-2), exact memory bounds (32KB Flash, 2KB SRAM), cycle-accurate instruction timing, call stack overflow warnings, and two-level interrupt entry (High 0x0008, Low 0x0018).
- GPIO: PORTA–E with TRIS/LAT/PORT read-modify-write semantics accurately modeled.
- Timers & PWM: Timer0–Timer3 modeled with prescalers and Fosc-derived counting limits. CCP1 PWM provides real duty cycle mapping to drive LED opacity.
- UART & I2C: UART features baud-rate-derived timing and RX FIFO. MSSP (I2C Master) handles START/ADDR/DATA/ACK sequences and emulates an external 24LC256 EEPROM.
- ADC & EEPROM: 13-channel 10-bit ADC with real Tad-gated conversion delays. 256-byte Data EEPROM with the authentic 0x55/0xAA unlock sequence requirement.
Note: The simulator is a powerful teaching tool, but it deliberately omits complex peripherals like the USB module, SPI mode on MSSP, and some advanced Config bits (_CONFIG1L through _CONFIG7H).
Frequently Asked Questions
Do I need to install an IDE or buy a dev board?
No! This PIC 18 simulator runs entirely in your web browser. You don't need to install MPLAB X, XC8, or buy expensive Microchip hardware. It's designed for students to learn the instruction set and architecture for free.
Is the simulation cycle-accurate?
Yes, the CPU core features cycle-accurate-ish instruction timing (handling 1-word vs 2-word instructions, taken-branch penalties, etc.). Crucially, peripherals like UART, ADC, and I2C are gated on real cycle counts derived from Fosc, not instant resolution, teaching you the right mental model for polling.
Does this PIC simulator support C code?
Currently, the simulator focuses heavily on PIC18 Assembly to help students understand the low-level architecture, memory structures, and instructions.
What microcontroller is being simulated?
The simulator specifically targets the popular PIC18F4550, a microcontroller widely taught in ITI, diploma, and polytechnic embedded courses.
Related Tools
Results are for engineering assistance. Verify important calculations and check official datasheets. See the Engineering Disclaimer.