PIC16F877A Oscillator pin problem?

t06afre

Joined May 11, 2009
5,934
A quick look of your code, also tell me what something is wrong with your this statement.
Rich (BB code):
CBLOCK 0x0C
FIRST
SECOND
THIRD
ENDC
I do not think the General Purpose Registers in your chip. Are at address 0x0C in your chip
 

t06afre

Joined May 11, 2009
5,934
I also see some places possible areas with solder bridges. Marked with red circles. I can not tell from the photo but check them out
 

Attachments

Thread Starter

lloydi12345

Joined Aug 15, 2010
103
A quick look of your code, also tell me what something is wrong with your this statement.
Rich (BB code):
CBLOCK 0x0C
FIRST
SECOND
THIRD
ENDC
I do not think the General Purpose Registers in your chip. Are at address 0x0C in your chip
I think it's not all about the program? because the circuit works well on my breadboard.

I'll just update my sample breadboard circuit components.

PIC pins:
1 - 10k ohms to Vcc
13&14 - XT osc (no filter caps going to the gnd)
15 - LED (no resistor)
32 - Vcc (no connection to pin 11)
31 - Gnd (no connection to pin 12)

The LED blinks properly. :C
 

Thread Starter

lloydi12345

Joined Aug 15, 2010
103
I also see some places possible areas with solder bridges. Marked with red circles. I can not tell from the photo but check them out
From the image, they look very near to each other but there's actually a lot of space from the spots you pointed out.

I hope I'm not causing you guys too much headache :(
 

t06afre

Joined May 11, 2009
5,934
I still think you should check figure 2-3 in the datasheet. What are address 0x0c,0x0d,0x0e used for. And is this GPR regsiters;)
 

Thread Starter

lloydi12345

Joined Aug 15, 2010
103
Oh, I didn't know 0x0C covers an address.. anyway here's my updated code thank you.

Rich (BB code):
    list        p=16f877A    ; list directive to define processor
    #include    <p16f877A.inc>    ; processor specific variable definitions
    
    __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF




CBLOCK 0x21
    FIRST
    SECOND
    THIRD
ENDC


    ORG     0x000            
      goto    main              ; go to beginning of program

    ORG     0x004 
; isr code can go here 


main

BANKSEL TRISC
MOVLW 0x00
MOVWF TRISC
BANKSEL PORTC

FORWARD:
    MOVLW B'00000001'
    MOVWF PORTC
    CALL DELAY
    MOVLW B'00000000'
    MOVWF PORTC
    CALL DELAY
    GOTO FORWARD

    
    
DELAY                        ;    1 second delay
        MOVLW .2
        MOVWF THIRD
LOOP_1_SEC:
        MOVLW .250
        MOVWF SECOND
LOOP_125_MS:
        MOVLW .250
        MOVWF FIRST
LOOP_.5_MS:
        NOP
        DECFSZ    FIRST,F
        GOTO    LOOP_.5_MS
        
        DECFSZ     SECOND,F
        GOTO    LOOP_125_MS
        
        DECFSZ    THIRD,F
        GOTO    LOOP_1_SEC
        return

END
But it still wont work on my PCB, the delay changed a bit on my breadboard. Looks like it really affects the program when i used 0x0C before.
 

Thread Starter

lloydi12345

Joined Aug 15, 2010
103
My bad I can't really make it work. I guess I'll be abandoning it and make a better PCB design for this. Thanks for the help guys! :D
 

t06afre

Joined May 11, 2009
5,934
My bad I can't really make it work. I guess I'll be abandoning it and make a better PCB design for this. Thanks for the help guys! :D
Give it one more change. But go over the boards and check for shorts and bad solder joints. Your error is typical for a bad solderjoint. And use a flat screwdriver between solder joints to remove any solder residue.
But if you create a new board. You must include series resistor on the LEDs.
 

Thread Starter

lloydi12345

Joined Aug 15, 2010
103
Give it one more change. But go over the boards and check for shorts and bad solder joints. Your error is typical for a bad solderjoint. And use a flat screwdriver between solder joints to remove any solder residue.
But if you create a new board. You must include series resistor on the LEDs.
After desoldering few components to change it, it messed up the copper board and it broke the connecting lines so I better make a better PCB design since I made the old design by just 1 day. Thank you for the support :)
 

t06afre

Joined May 11, 2009
5,934
A tip. Do not solder inn all components before start testing. Start with 7805 circuit and the MCU with some LEDs (with series resitors ofcourse). Then this is working. Mount the next unit and test it, and so on. I also see that you have no decoupling caps. That may cause problems. Make it a habbit of always include space for a 100nF cap for every component, on all supply rails. Remember they also have to be mounted correct. Use Google for more info
 

thatoneguy

Joined Feb 19, 2009
6,359
After desoldering few components to change it, it messed up the copper board and it broke the connecting lines so I better make a better PCB design since I made the old design by just 1 day. Thank you for the support :)
You may also want to turn down the heat on your soldering iron if the copper is de-laminating from the board.

Heat the lead and PCB up at the same time, and use just a tiny amount of solder to complete the job. Some of the blobs are kind of big in your bottom pic, which hint that either component lead or PCB wasn't at full heat when solder was added.

Last point: Add a solder pad for all IC Pins for mechanical stablity. The power decouping caps can also go on the bottom side of the board, either SMD caps, or a standard 0.1uF thin cap laid on it's side.
 
Top