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.

oscillator problem

Status
Not open for further replies.

gomathi

New Member
sir

i wrote simple led display program for pic16f877

i download hex into pic ic using picall porogrammer.

now i connect to 4MHZ oscillator on 13 and 14 pin of PIC .

22pf capacitor is grounded.

problem is when shake the oscillator only i will get output.

can u find out where problem was?
 
There is a possibility of dry solder too. On what material/base have you constructed your circuit?
 
May be the connections are loose on your breadboard. Also breadboard has more noise than vero-boards and PCBs. Have you used decoupling capaciotor (0.1uF) across Vdd-Gnd Pins of your PIC? If not connect it. It reduces considerable amount of noise. Make this as a practice. Always use decoupling capacitor across the power pins of all ICs in your project.
 
kinjalgp said:
May be the connections are loose on your breadboard. Also breadboard has more noise than vero-boards and PCBs. Have you used decoupling capaciotor (0.1uF) across Vdd-Gnd Pins of your PIC? If not connect it. It reduces considerable amount of noise. Make this as a practice. Always use decoupling capacitor across the power pins of all ICs in your project.

sir,thanks for ur reply

i connected 0.1uf across vdd and gnd pin of PIC16f877

instead of 4mhz crystal and 22pf capacitor shall i use 4MHZresonator oscillator.
 
Yes even that will work. But before changing make sure that the crystal is the one that is causing problem. Otherwise there is no point in changing it.

Also try to build your circuit on a vero board or PCB. It will really help if the problem is related to noise or loose connections.
 
kinjalgp said:
Yes even that will work. But before changing make sure that the crystal is the one that is causing problem. Otherwise there is no point in changing it.

Also try to build your circuit on a vero board or PCB. It will really help if the problem is related to noise or loose connections.

i think problem in program

LIST P=16F877
#include <P16F877.INC>
__CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _RC_OSC & _WRT_ENABLE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF


ORG 0x00

BSF STATUS, RP0 ;bank 1
CLRF TRISB ;make all portB pins output
CLRF TRISC
BCF STATUS, RP0 ;bank 0

MOVLW 0xFF
MOVWF PORTB ;put 0xFF in port B (all pins high)
MOVWF PORTC

END

can u tell me this program is correct or not

and configuration word is correct or not
 
Try this:

Code:
   LIST P=16F877 
   #include <P16F877.INC> 
   __CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _RC_OSC & _WRT_ENABLE_ON & _CPD_OFF 


   ORG 0x00 

   BSF STATUS, RP0 ;bank 1 
   CLRF TRISB ;make all portB pins output 
   CLRF TRISC 
   BCF STATUS, RP0 ;bank 0 

AGAIN:
  CLRWDT
  MOVLW 0xFF 
  MOVWF PORTB ;put 0xFF in port B (all pins high) 
  MOVWF PORTC 
  goto AGAIN

END

There are a few small problems with your code. First, there is no code beyond the end statement. After executing this code segment, the PIC will proceed execution to whatever may exist beyond the code your programmed. Most likely it will be NOP and eventually the program counter will overflow back to 00h and no problem will be observed. However, you enabled the watchdog timer and without the CLRWDT instruction, the PIC will reset.

I also removed low voltage programming and debug options because they might interfere with execution.

It is likely a hardware problem. Go check with the oscillator pins if there is a signal using an oscilloscope or logic probe.
 
LIST P=16F877
#include <P16F877.INC>
__CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _RC_OSC & _WRT_ENABLE_ON & _CPD_OFF


You configured the pic for a RC oscillator... You'll need to set it to _XT_OSC to work with a crystal
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top