I am trying to set RB0 - 7 as digital inputs on my PIC16F818 microcontroller. In order to do that I used the following config:
void config() {
//cmcon = 0x07; // Sets all IO pins to digital
trisa = 0xFF; // Set porta as inputs
trisb = 0x00; // Set portb as outputs
adcon1 = 0x07; // For PIC16F84A comment the line above and uncomment this statement
portb = 0x00; // Reset value of portb (portb = 0)
_CONFIG & _CP_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF & _MCLR_OFF & _INTRC_IO & _WRT_ENABLE_OFF & _PWRTE_OFF;
}
I test this setting by mapping my porta (8 switch block) to portb (8 bit led block), switches 0 - 4 are working correctly, but switches 5-7 are not responding, however bits are set internally by some other PIC functions and output: (b5)0 (b6)0 (b7)1.