title: How to flash the LED with push button - pic18f
body: <p>I made a simple circuit to blink an LED, but the code does not work in proteus simulation. See the code and the simulation below.</p>
  
  <pre><code>#INCLUDE "P18F2550.INC"
  
  CONFIG WDT=OFF
  CONFIG OSC=HS
  CONFIG LVP=OFF
  
  R2  EQU 0x2
  R3  EQU 0x3
  R4  EQU 0x4
  
  ORG 0x0000
  
  ;Definindo todos os pinos de TRISA como entrada
  MOVLW   b'11111111'
  MOVWF   TRISA
  
  ;Definindo todos os pinos de TRISB como entrada
  ;exceto o pino 0 (RB0)
  MOVLW   b'00000000'
  MOVWF   TRISB
  
  MOVLW 0x0000
  MOVWF INTCON2 ;habilita a portB para 1
  
  MAIN
      BTFSS   PORTA, RA0 ;Lê entrada do bit 0 de PORTA
      GOTO    ESTA_OFF
      ESTA_ON
          BSF PORTB, RB0; Manda 1 para RB0
          GOTO MAIN
  
  ESTA_OFF
      BCF PORTB, RB0 ;Manda 0 para RB0
      GOTO MAIN
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/9hU3A.png" alt="enter image description here"></p>
  
  <p>Does anyone have a solution to the problem? Thank you very much.</p>