Quote Originally Posted by Dick Ivers View Post
Connect the dip switches to GND not Vcc
Enable portb pullups

yourvar var byte

yourvar = portb

yourvar ^ %11111111 'invert all 8 bits of the variable

'send the decimal value of yourvar to LCD screen
Hi Dick,
I did what you said and now, it works like the 1st time, my switches aren't inverted and I have to connect to GND a pin to see its value. With the first mod you gave me, all was inverted and VCC had to be used but it was not a problem for me.
With this small piece of code, I've learned a lot of things but I already have my PortB.3 and my PortB.4 returning every time a zero.

Well... You'll think I'm stupid... I've checked all the hardware, my PIC is not directly connected, there is a DIL support under and I've found this DIL support is defective and have no connection on 2 pins !!!
Yes, it was a hardware error ! Arrrgh.

Your help was really useful, now I know how to have simple pull-ups how to invert bits variable and with this both tips, how to make a pull-down it's better for my PCB.

Thanx a lot, this file is now closed for me.