Thanks Zuisti,
I am using 16F684 and this does not work. will try again.
Hi Jaikumar,
Please read carefully the data sheet:
http://ww1.microchip.com/downloads/en/devicedoc/41202C.pdfAn extract from this:
4.3 PORTC
Note: The ANSEL (91h) and CMCON0 (19h)
registers
must be initialized to configure
an analog channel as a digital input. Pins
configured as analog inputs will read ‘0’.
EXAMPLE 4-3: INITIALIZING PORTC
BCF STATUS,RP0 ;Bank 0
CLRF PORTC ;Init PORTC
MOVLW 07h ;Set RC<4,1:0> to
MOVWF CMCON0 ;digital I/O
BSF STATUS,RP0 ;Bank 1
CLRF ANSEL ;digital I/O
MOVLW 0Ch ;Set RC<3:2> as inputs
MOVWF TRISC ;and set RC<5:4,1:0> as outputs
BCF STATUS,RP0 ;Bank 0
Hope this helps!
zuisti