16f690 portc problem

Thread Starter

Dodgydave

Joined Jun 22, 2012
8,295
I am using PORTC to run a series of leds from RC0 to RC7 and back just like the Knight rider display, i can get it to work up and down from RC0 to RC5 ok, but when i set it to use bits 6&7 it stops at RC6.

is there some other setting to enable bits 6&7 to work, i have looked at the SSPCON register (page 159) in the datasheet and noticed bits 0-3,5 are mentioned.

so i tried this line>> movlw b'00000101' 'in either Bank1 or Bank0'
............................movwf SSPCON

and still no joy???

any clues...?
 

Markd77

Joined Sep 7, 2009
2,796
As far as I can tell from the datasheet, the default setting of 0x00 for SSPCON should allow the pins to be used as digital outputs. As long as bit 5, SSPEN is clear you should be OK.
SSPCON is only in bank 0, if you are in bank 1 then you will be modifying SSPSTAT instead.
What is your initialisation code?
 

Thread Starter

Dodgydave

Joined Jun 22, 2012
8,295
well i dont know what i have done, but its now working if i put the line in clrf ANSELH
 

Markd77

Joined Sep 7, 2009
2,796
ANSELH controls digital/analog IO on AN8,9,10 and 11.
AN8 and 9 are on PORTC 6 and 7 so it makes perfect sense that clearing them would have some part in fixing it.
 
Top