# PIC (16F627A) inverted inputs

I'm having problem with inputs of my PIC.

There is somethink like "default value" on all inputs set to logical 1 so if I want to change the state I need to pass GND.

How can I turn it "otherwise"? This is begining of my code:

#include <htc.h>
#include <pic.h>
#include <pic16f627a.h>

__CONFIG(WDTE_OFF & PWRTE_OFF & FOSC_INTOSCCLK & MCLRE_OFF & BOREN_OFF & LVP_OFF & CPD_OFF & CP_OFF);

int main (void)
{
unsigned int i, j;

unsigned short count = 0;

TRISA = 0;
TRISB = 0b11110000;
PORTA = 0;
PORTB = 0;
nRBPU = 0;
CMCONbits.CM = 7;
...


I don't understand electronics very much and I'm also kind of new to programming in C.

Thank you for any help.

• What you are talking about is a pullup resistor. And I am pretty sure that the PIC doesn't have a pulldown. That means, you are only able to make the default value logic 1. Unless you use an external pulldown resistor. en.wikipedia.org/wiki/Pull-up_resistor – Dzarda Nov 6 '13 at 23:57
• Oh my god, I feel so stupid now. Thank you so much. Could you please send this as an aswer so I can accept it? – grongor Nov 7 '13 at 10:16
• By the way, if I would like to use internal pull-up resistors, is there any way of "inverting" inputs so I still can use "positive logic"? Now I used "if (!RB0) { ... }" which was trigged when RB0 button was pushed. I would like to not have to use negation in every condition. – grongor Nov 7 '13 at 10:29