Problemas con programa para PIC16F883 en XC8

Hola a todos. Estoy teniendo un problema elemental y que por ahí es una pavada pero no me estoy dando cuenta qué es.
El programa a la hora de simularlo en el proteus como que no me toma las entradas, ya que no estaría entrando en los if.
Es un programa muy elemental, ya que estoy tratando de pasar de usar el 16F873A a este 16F883 y después de adaptar todo el código no me funcionó, así que me puse con algo más básico y tampoco me funcionó.
No sé si me falta configurar algún registro o algo así.

Les pongo el código que como verán es muy elemental
C:
// CONFIG1

#pragma config FOSC = EXTRC_CLKOUT// Oscillator Selection bits (RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN)

#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register)

#pragma config PWRTE = OFF      // Power-up Timer Enable bit (PWRT disabled)

#pragma config MCLRE = ON       // RE3/MCLR pin function select bit (RE3/MCLR pin function is MCLR)

#pragma config CP = OFF         // Code Protection bit (Program memory code protection is disabled)

#pragma config CPD = OFF        // Data Code Protection bit (Data memory code protection is disabled)

#pragma config BOREN = OFF      // Brown Out Reset Selection bits (BOR disabled)

#pragma config IESO = OFF       // Internal External Switchover bit (Internal/External Switchover mode is disabled)

#pragma config FCMEN = OFF      // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled)

#pragma config LVP = ON         // Low Voltage Programming Enable bit (RB3/PGM pin has PGM function, low voltage programming enabled)



// CONFIG2

#pragma config BOR4V = BOR40V   // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V)

#pragma config WRT = OFF        // Flash Program Memory Self Write Enable bits (Write protection off)



// #pragma config statements should precede project file includes.

// Use project enums instead of #define for ON and OFF.



#include <xc.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define _XTAL_FREQ 320000



void main(){

  

    TRISBbits.TRISB0=1;

    TRISBbits.TRISB1=1;

    TRISBbits.TRISB6=0;

    TRISBbits.TRISB7=0;

    PORTBbits.RB6=0;

    PORTBbits.RB7=0;

  

    while(1){

        __delay_ms(1);

        if(PORTBbits.RB0==1){

            PORTBbits.RB7=1;

        }

        __delay_ms(1);

        if(PORTBbits.RB1==1){

            PORTBbits.RB6=1;

        }

    }



}
 
Atrás
Arriba