Reply by ogarianoxman August 15, 20032003-08-15
hi xeemv,

i too used 16F877A with 20MHz and PBP. i too had problem getting
20MHz crystal to work. here are some recommendations based on my
similar experience:

first, check your PIC chip to make sure it works at 20MHz. i know
that 16F877A is rated for up to 20MHz as per the datasheet, but if
you ordered the free sample version from Microchip there is a likely
chance you received some of their old batch that they try to give
out first, obviously, which is rated for 4 MHz only! you can
determine if you have a 20MHz version by reading the Part Number
stamp on your chip, it should read something to the effect
of: "PIC16F877A-I20" or something like that. there should be
a "20" near the end and not a "04".

also, you provided Basic code in your message that says you defined
operation for 20MHz. but in your cut/paste code snippet i see you
defined for 8MHz.

it should read:
DEFINE OSC 20
not
DEFINE OSC 8

do not forget that crystal oscillators require two capacitors. i
found that my 28pF caps worked great with 4 MHz, but did not work at
20MHz. i switched capacitors to 10pF and it started working.

good luck
slloyd --- In , "xeemv" <xeemv@y...> wrote:
> I have trouble getting the 20 Mhz oscillator to work with 16f877A
> Oscillator: Saronix 9942k 20.0000 Mhz NCH060C
>
> This is what I have done so far:
>
> 1) I connect the 20 Mhz oscillator to the OSC1 of the PIC and
leave the
> OSC2 open.
> 2) I define my oscillator speed as follow: DEFINE OSC 20 since i
use Pic
> Basic Pro compiler. I change my oscillator type to HS
>
> codes:
>
> DEFINE OSC 8
>
> loop:
> high portb.0
> pause 500
> low portb.0
> goto loop
>
> The above codes work fine with a 4Mhz oscillator but not the 20Mhz.
>
> How do I get the program to work with the 20Mhz oscillator?




Reply by fjch100 August 14, 20032003-08-14
I had problems some time ago with a canned oscillator
check with a scope the voltage levels. Sometimes there are not CMOS
levels --- In , "xeemv" <xeemv@y...> wrote:
> I have trouble getting the 20 Mhz oscillator to work with 16f877A
> Oscillator: Saronix 9942k 20.0000 Mhz NCH060C
>
> This is what I have done so far:
>
> 1) I connect the 20 Mhz oscillator to the OSC1 of the PIC and
leave the
> OSC2 open.
> 2) I define my oscillator speed as follow: DEFINE OSC 20 since i
use Pic
> Basic Pro compiler. I change my oscillator type to HS


Reply by rtstofer August 14, 20032003-08-14

Without a delay after "low portb.0" that is going to be a very narrow
pulse. Something like 600 nS if the compiler generates good code.

What are you using to check the output?

--- In , "xeemv" <xeemv@y...> wrote:
> I have trouble getting the 20 Mhz oscillator to work with 16f877A
> Oscillator: Saronix 9942k 20.0000 Mhz NCH060C
>
> This is what I have done so far:
>
> 1) I connect the 20 Mhz oscillator to the OSC1 of the PIC and
leave the
> OSC2 open.
> 2) I define my oscillator speed as follow: DEFINE OSC 20 since i
use Pic
> Basic Pro compiler. I change my oscillator type to HS
>
> codes:
>
> DEFINE OSC 8
>
> loop:
> high portb.0
> pause 500
> low portb.0
> goto loop
>
> The above codes work fine with a 4Mhz oscillator but not the 20Mhz.
>
> How do I get the program to work with the 20Mhz oscillator?




Reply by Wouter van Ooijen August 14, 20032003-08-14
> I have trouble getting the 20 Mhz oscillator to work with 16f877A
> Oscillator: Saronix 9942k 20.0000 Mhz NCH060C

Are you sure your osc does oscillate? Some have an enable pin, some
don't.

For the code: the only difference between the various crystal settings
is the aplification, which should not matter because you use and
external osc, not a crystal. So try with exactly the same code as you
used for 4 MHz.

Wouter van Ooijen

-- -------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products


Reply by xeemv August 13, 20032003-08-13
I have trouble getting the 20 Mhz oscillator to work with 16f877A
Oscillator: Saronix 9942k 20.0000 Mhz NCH060C

This is what I have done so far:

1) I connect the 20 Mhz oscillator to the OSC1 of the PIC and leave the
OSC2 open.
2) I define my oscillator speed as follow: DEFINE OSC 20 since i use Pic
Basic Pro compiler. I change my oscillator type to HS

codes:

DEFINE OSC 8

loop:
high portb.0
pause 500
low portb.0
goto loop

The above codes work fine with a 4Mhz oscillator but not the 20Mhz.

How do I get the program to work with the 20Mhz oscillator?