PDA

View Full Version : 16F88 and external Oscillator



Mugelpower
- 26th December 2017, 08:48
Have nice holidays and sort of!

I built a project with a 18F1320 and a 16F88.
The 18F1320 has an external oscillator with 20 MHz that goes to CLKI and should squeeze 20 MHz out of CLKO (RA6) which runs to the 16F88 CLKI Input (RA7) .
Bothe have osc defines of 20 but the 16F88 runs waaay to slow (about 4 times slower than expcted).
Made two simplest program to test both, therefore the defines are of old working programs which will be used for these PICs and this project, exept the osc things. But the 16F88 will measure engine temp and control via HPWM the electric water pump and send the temp via DEBUG to the 18F1320 which shows it (and other things) at the 4 Line LCD.
Had the communication established via 16F88 and a 16F876A wich worked so i will get it going between 16F88 and 18F1320, with a little help of my friends, of course.
I tried several external 16F88 defines like _FOSC_HS,_HS_OSC and other out of the Device Reference files.

so maybe the define of the 18F1320 is wrong but that one works with the right speed.

Please help if you like to.
85448545

Mugelpower
- 26th December 2017, 08:52
Hello all around!
I tried to put a EAGLE schematic attachment into this and I got the answer "Invalid file". How do I convert an Eagle document? I have to save PBP docs into txt format to post them. Is there anything like for EAGLE ?
regards
Mugel

tumbleweed
- 26th December 2017, 12:45
In EC mode the clock out on RA6 is FOSC/4, so with 20MHz on CLKI, CLKO will be 5MHz

HenrikOlsson
- 26th December 2017, 12:55
To post the schematic, either make a screen dump and post the image or print/export to .pdf and post that.

I was going to say exactly what tumbleweed just did so now I won't, but I'll say this:
Is it an actual oscillator (not a crystal or resonator) then you should be able to drive both PICs directly from the output of the oscillator but check the datasheet for the oscillator, I believe you can use either HS or EC mode for this.

/Henrik.

Mugelpower
- 29th December 2017, 14:27
Hello Henrik,
Iīll try to get the image. No didnīt work, had 8MB Picture max is 1 MB.

Mugelpower
- 29th December 2017, 14:33
Old Farts and Computers,

here we go...8548

HenrikOlsson
- 29th December 2017, 19:25
OK, so it is a proper oscillator.
Then just drive both PICs directly from it it. The way you have it now the second PIC will run at 1/4 the speed of the first one.

Use .png instead of .bmp for images like this, much better!

/Henrik.

Mugelpower
- 30th December 2017, 13:53
Made several mistakes, killed one 18F1320 donīt know how , destroyed my PICKIT operating system, had to desolder and solder one 18F1320, BIG Mistake in the schematic: I had to use the lower 4 bits of PORTA and these begin at PORTA0 not PORTA1 . Put a resistor between 74HC14 and RB1 otherwise the PIC may be grilled.
Changed config:
#CONFIG
CONFIG OSC = HS ;Clock out on RA6 :1/1 CLKI
#ENDCONFIG
now the second PIC gets the same frequency out of the first PIC. Checked it with a scope.

Hardware seems to work (if nothing else is grilled) and I can jump into software.85498550