Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: resna on April 18, 2008, 02:44:15 AM
-
Hello everyone,
Im using a pic16f877a microcontroller.
Is there any chance, the minutest, littlest of chance that the pins RC7 and RC6 would be set logical high for the following code
ORG 000H
GOTO MAIN
ORG 200H
MAIN
NOP
GOTO $
END
I know this is completely out of the ordinary. But I just want to know if something like what I mentioned is even remotely possible because for the above program my RC7 and RC6 pins are high.
If something like that is not possible then it must be some electrical problem in my development board.
Thank you
-
Yes there is a chance. You should never assume that registers and ports are set up like you think on reset. You must always configure them yourself.
Try changing your code to configure the ports. Here -
ORG 000H
GOTO MAIN
ORG 200H
MAIN
BANKSEL TRISC
MOVLW 0x00
MOVWF TRISC ;Set them all to output
BANKSEL PORTC
MOVLW 0x00
MOVWF PORTC ;Set them all to logical low
LOOP NOP
GOTO LOOP
END