PIC16F84
PIC16F84 StudioCPU emulator · debugger · virtual peripheral laboratory
Ready
0 cycles
Registers8-bit MCU · 14-bit code
Next PC: 000
Execution listingclick address to toggle breakpoint
Memoryphysical
SS:SP / ports
Trace
VIRTUAL HARDWARE LABORATORY

PIC16F84 peripherals

PORTB is the 8-bit data bus. PORTA bits 0–3 select an external latch; pulse RA4 high to write it. Select switches, keypad or buttons as the PORTB input source. Configure TRIS directions in your program.

LED bankLatch 0
D7 D6 D5 D4 D3 D2 D1 D0
Each data bit drives one LED.
Toggle switchesPORTB input
8-BIT INPUT BANK
Select Switches; set TRISB = 0xFF to read.
4-digit 7-segment displayLatches 1–4
One latch per digit. Low nibble selects 0–F.
2×16 character LCDLatches 5 / 6
VSS VDD VO RS RW E D0 D1 D2 D3 D4 D5 D6 D7 A K
5: command (1 clear, 0x80 line 1, 0xC0 line 2). 6: ASCII character.
4×4 hexadecimal keypadPORTB input
Select Keypad; read 0–15 while held, 0xFF when released.
Buttons & buzzerLatch 7 / RB0 INT
START/STOP/IRQ are input bits 0/1/2. IRQ also pulses RB0. MCLR resets CPU. Latch 7 controls a 660 Hz buzzer.
Serial terminalLatch 8
External parallel-to-serial teaching bridge. Write an ASCII byte; the PIC16F84 has no built-in UART.
64-byte data EEPROM
EEPROM survives MCLR and program reload. Full Reset clears it. Timing is a deterministic teaching approximation.
I/O BUS
Idle

PIC16F84 wiring & instruction guide

External laboratory board

PORTB (RB7–RB0) is an eight-bit data bus. RA3–RA0 select a board latch, and a rising RA4 edge clocks the byte into it. RA4 is treated as having an external pull-up. Configure TRISA = 0 and TRISB = 0 for output. The board is an external teaching accessory, not extra PIC memory or instructions.

LatchOutput
Latch 0LED bank
Latches 1–44-digit 7-segment display
Latches 5 / 62×16 character LCD
Latch 7 / RB0 INTButtons & buzzer
Latch 8Serial terminal
BSF STATUS, RP0
CLRF TRISA
CLRF TRISB
BCF STATUS, RP0
CLRF PORTA       ; select LED latch; RA4 low
MOVLW 0xAA
MOVWF PORTB
BSF PORTA, 4     ; rising clock: capture data
BCF PORTA, 4

To read inputs, choose their source above the lab and set TRISB to 0xFF. Switches return eight bits; keypad returns 0–15 or 255; buttons return a bit mask. PORT writes and bit operations follow PIC read-modify-write behaviour, so always configure direction first.

CPU and internal peripherals

1,024 × 14-bit program words, 68 RAM bytes at 0x0C–0x4F (mirrored in bank 1), 64 EEPROM bytes, W, STATUS, FSR/INDF, PCL/PCLATH and an eight-level circular hardware return stack. STATUS.RP0 selects the file-register bank. A name such as TRISB does not switch banks automatically.

Timer0 supports its internal instruction clock, external RA4 edges, prescaler and overflow flag. Interrupt sources are RB0/INT, RB4–RB7 change, Timer0 and EEPROM completion; vector 004. Interrupt handlers must save W and STATUS themselves. The stack wraps after eight pushes, as on the device.

EEPROM uses the EECON2 0x55/0xAA unlock sequence and WREN/WR. Completion is accelerated to four instruction cycles. The optional watchdog uses nominal timing at a 4 MHz oscillator, not analogue oscillator tolerances. SLEEP suspends the runner; apply an enabled interrupt then Step or Run to wake. This is an instruction-level educational simulator, not an electrical or silicon timing model.

Assembly and Hex

All 35 core instructions plus the legacy compatibility OPTION and TRIS instructions are assembled, decoded and executed. File destinations are W/0 or F/1; omitted destination defaults to F. Decimal is the default; use 0xAA, H'AA', B'10101010', or D'170'. Supports labels, EQU, CBLOCK/ENDC, ORG, DW, __CONFIG and DE at ORG 0x2100. Standard device symbols are built in. Macros and external include processing are not implemented; LIST/INCLUDE device headers are accepted for compatibility.

Hex mode accepts standard Intel HEX with checksums, or four-digit 14-bit words such as 000: 30AA 0086. Intel HEX uses byte addresses; the listing and word-entry format use word addresses. Saving Hex exports Intel HEX. Assembly/Hex switching reassembles or disassembles; original comments and labels cannot be reconstructed from opcodes.

Debugging

F7 executes one instruction. Gold register highlights remain until another instruction executes. F8 steps over CALL; Pause can interrupt it. Click an execution address to toggle a breakpoint. Run stops before that address; Step executes through it. Full Reset clears CPU, memories, breakpoints, trace and hardware while retaining the editor text. MCLR performs PIC reset semantics: program and EEPROM are retained, unaffected file registers/W are preserved, while documented reset-state control registers are restored.

Choose a demo, press Assemble & load, then Step or Run. Input demos loop: use Pause to inspect them. Font settings include a master Panel font control and independent window controls.

Microchip PIC16F84 datasheet (DS30430D)

Keyboard shortcuts

F5RunF6PauseF7StepF8Step over CALLCtrl/⌘ + EnterAssemble / loadCtrl/⌘ + OOpen sourceCtrl/⌘ + SSave named fileCtrl/⌘ + RFull ResetTab / Shift+TabIndent / unindent

Name your file

.asm

Guided tour

1Choose a demo or type/import a program. The editor starts blank.
2Assemble & load. The listing shows real 14-bit instruction words.
3Step with F7. Gold highlights show the last instruction’s changes until the next instruction.
4Click an address for a breakpoint. Inspect banked RAM, stack, trace and EEPROM.
5Open Wiring guide for the external lab. Select inputs and configure TRIS in code.
6Use Panel font for all windows or each window’s own font control.