Pic16f877a

Thread Starter

msdagiya

Joined Apr 21, 2012
3
Hi,

I am powering my PIC from USB with 470 uF capacitots of 5 and 0 volts. I am also using 970 Ohm resistor for POR. with two seven segments connected. I programmed my PIC with ICSP. using this code:

PROCESSOR 16f877a
#include "p16f877a.inc"

org 0x00
movlw 0x00
movwf TRISC
movlw 0x00
movwf PORTC
movlw 0x00
movwf TRISD
movlw 0xFF
movwf PORTD
end


my seven sgment should show seven on display instead it shows one. some time random LEDs are glowing. some time none of the LED works. seems like PIC is not programmed properly. But I tried reprogramming it successfully. At least it shows program successful when I program it. Can any one tell me if I am missing any thing. I also have crystals with right capacitors. My power pins are connected properly. PLease help
 

tshuck

Joined Oct 18, 2012
3,534
Telling us what you think you did does not help. Provide a proper schematic and we will have a place to start.

Secondly, you are not doing a bank switch, meaning your TRIS setting is writing to the port instead.
 

t06afre

Joined May 11, 2009
5,934
And also the configuration words(s) are not set. At least not in the code. Your code should also be placed in some endless loop. The errors you have done are quite common for beginners. Then working with PICs. A lot of reading in the datasheet are required
 
Top