Hi guys. I have connected 8 wires with 5 volts at the 8 pins of portB .PortC is ok.It makes only a serial communication and i have tested it.

I made that program in order to understand when the wires are 0V or 5V and which of these are 0V or 5V .For example if the RB7 takes 1 (+5 volts)and the others 0 (0volts) i want to take the number 127.

INCLUDE "modedefs.bas"

TRISB=%11111111 (i make them all inputs)
TRISC=%00000010
B0 VAR BYTE



loop:
Peek PORTB,B0

SerOut2 PORTC.0,84,["I took:",DEC B0,13,10]

GoTo loop

But it doesn't work this way.fOR EXAMPLE when i had 5 volts only at RB0 (and the others had no voltage) i took number 5 and not 1 as i expected.

hAS anybody any idea how to do it? Thanks