PB7, PC6, PC7, PD7 not working well on ATMega32
I am making 16*16 keypad(on PORTB and PORTD) with ATMega32 using proteus 6.9 and AVRstudio5. 
My problem is PB7 and PD7 does not work as designed. I changed PORTs to PORTC and again PC6 and PC7 doesnt work. 
In any case PC6 and PC7 doesnt give output. I tried changing SFR and too got no solution. 
My avr code is attached below. 
Please help. I am wasting a lot of days on this. http://pastebin.com/8yM0LJdr
PB7, PC6, PC7, PD7 not working well on ATMega32
===

I am making 16*16 keypad(on PORTB and PORTD) with ATMega32 using proteus 6.9 and AVRstudio5. 
My problem is PB7 and PD7 does not work as designed. I changed PORTs to PORTC and again PC6 and PC7 doesnt work. 
In any case PC6 and PC7 doesnt give output. I tried changing SFR and too got no solution. 
My avr code is attached below. 
Please help. I am wasting a lot of days on this. http://pastebin.com/8yM0LJdr