Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

XTAL Problem in PIC 16F877A

Status
Not open for further replies.

Hesam Kamalan

New Member
Hi
I have a problem with 16f877a. I build a PCB for this PIC component. After programming (for example I wrote blinking LED), LED is off, but when I touch XTAL, LED turned on continuously. I change XTAL several times but outcome was the same. My XTAL is 20MHz and Caps 33pF.
 
That's why the XTAL's body must be soldered to GND and ofcourse the PCB's GND must be rastered.I think this method will solve your problem.
P.S. You can use oscillators insted of XTAL.They are more stabile.
 
Can you send the start of your code (where you define PIC, OSC, etc)?

Do you have any 20pf caps? Maybe try swapping the 33 for something smaller.
 
Thank you very much for your Helps and advertises, my code is written as follows:
PROCESSOR 16F877A
#INCLUDE "P16F877A.inc"
#INCLUDE "HESAM.INC"

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

CBLOCK 0X20
HICNT
LOCNT
LOOPCNT
ENDC

ORG 0X00
BANK3
MOVLW 0X02
MOVWF ADCON1
BANK1
MOVLW 0X00
MOVWF TRISE
BANK0
MOVLW 0X00
MOVWF PORTE

MAIN:
MOVLW 0X01
MOVWF PORTE
PAUSEMS 500
MOVLW 0X02
MOVWF PORTE
PAUSEMS 500
MOVLW 0X04
MOVWF PORTE
PAUSEMS 500

GOTO MAIN

END
 
1. you must use HS_OSC
2. Be sure you connect all VSS lines and all VDD line
3.as suggested, try something in between 15-33pF
4. be sure your MCLR pin is tied to VDD via resistor
5. Be sure you'd place capacitor (0.1uF) as close as possible of your PIC. For this one, i suggest 2, one on each side as you have VDD and VSS on both side of it.
 
As suggested, use smaller capacitors, check my tutorial hardware at which uses 12pF ones. You don't mention how you're building it?, but you need as short a leads as possible, both to the crystal and from the capacitors to 0V.

As also suggested, it's important that you select HS_OSC, which is for high speed crystals.
 
Your problem may be that you have not disabled LVP in the configuration fuses and you have left the PGM pin 'floating'. I've seen these symptoms described many times and easily corrected by reprogramming the PIC with the LVP option in the config' fuses turned off.

Regards, Mike
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top