Circuit will not work with 20MHZ xcal

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Puddy32
Posts: 7
Joined: Sat Mar 24, 2012 12:49 am
Has thanked: 1 time

Circuit will not work with 20MHZ xcal

Post by Puddy32 »

Hi guys
Im a bit stuck at the moment
I am trying to get a motor running with PWM and things were going well but I wanted a higher PWM frequency for better control and eliminate audible hum.
So I changed out my 4MHZ crystal and put in a 20MHZ made all the necessarily changes but nothing works properly now. Im using a 16F877A
Went back to basics and made a simple program(led flashing, lcd screen flashing message) with the correct configs and it ran ok on my EB006.
But in my circuit it just doesnt run, very erratic , the screen displays once and then nothing, the led flashes erratically and then stops after 30seconds.

After numerous different attempts I put back in my 4MHZ; in HS mode it doesn't work but when i change to XT it works perfectly.
My settings: project options=20KMZ, Configure options= Xcal HS , circuit 22pF with the crystal, have power and gnd where it should be, 10K between power and MCLR. have caps between power and ground.
One thing when i change to XT in the menu, exit and re-enter the selection has automatically gone from XCAL to RC, is that normal? so the 4MHz circuit that worked would be RC XT.
could there be a setting in the compiler options i need to change?
Hope thats understandable.
Puddy

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Circuit will not work with 20MHZ xcal

Post by medelec35 »

Hi Puddy,
did you get your hardware to run OK?

If not, can you post your flowchart and the compiled hex and C code and I can see if I can spot something for you.

Martin.
Martin

Puddy32
Posts: 7
Joined: Sat Mar 24, 2012 12:49 am
Has thanked: 1 time

Re: Circuit will not work with 20MHZ xcal

Post by Puddy32 »

Hi Martin
Thanks for inquiring.
After three days of torture i found the problem, it was the capacitors on the voltage regulator,they werent the correct value.
They were close but not right, when I put in the correct values it worked.
So obviosly if your working with a high frequency xcal you need to have the proper caps.
Hope this help someone.

Puddy

Post Reply