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.
| Latch | Output |
|---|
| Latch 0 | LED bank |
| Latches 1–4 | 4-digit 7-segment display |
| Latches 5 / 6 | 2×16 character LCD |
| Latch 7 / RB0 INT | Buttons & buzzer |
| Latch 8 | Serial 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)