I know it is silly but cannot see why is not working the bitwise function. The code is:

for i=240 to 250
temp=portb
portb=temp & i
pause 100
next i

Port B high nibble is input while the low nibble is output. I read the whole port and want to keep the upper since they are related to Interrupt on change. So on the lower I want to follow the counting of i.

The lower nibble always reads and presents as 0000 !

If anyone sees what I don't please reply. It drives me mad!

Ioannis