Skip to content

Step 7 of 11

Wire LED and button in Proteus

Goal

Have the circuit ready to load the .HEX — no code changes in this step.

This step is Proteus hardware only (or verify your board). Code stays the same as step 5.

RB0: pin → 220–330 Ω resistor → LED (anode) → cathode to GND. RB1: NA button between pin and GND; 10 kΩ from RB1 to Vdd (pull-up).

  1. Open Proteus ISIS: PIC18F4550, 20 MHz crystal, caps and reset per minimum system.
  2. Wire LED on RB0 with series resistor.
  3. Wire button on RB1 with pull-up (resistor to Vdd).
  4. Save the schematic — do not load HEX yet; that is step 7.
						        LIST    P=18F4550
        #include <P18F4550.INC>

        CONFIG  FOSC = HS
        CONFIG  WDT = OFF
        CONFIG  LVP = OFF
        CONFIG  PBADEN = OFF

        ORG     0x0000
        GOTO    inicio

init_gpio:
        BCF     TRISB, 0      ; RB0 salida (LED)
        BSF     TRISB, 1      ; RB1 entrada (pulsador)
        RETURN

inicio:
        CALL    init_gpio
bucle:
        GOTO    bucle

        END
					
  • Proteus schematic (or board) has LED on RB0 and button on RB1.
  • Code is unchanged from the previous step.

Tip: If you simulate LED only first, you can leave RB1 floating until step 8.