PDA

View Full Version : 18F4550 pri osc & tmr1 question (proberbly stupid)



comwarrior
- 27th September 2009, 14:24
ok, 24MHz HS xtal for master osc... Not using USB atm...
I'm selecting my OSC as HSPLL with PLL devision 6 and MCU clock devision _2 which acording to the datasheet gets me 48MHz...

Now, i come to checking the setup of TMR1... on the 877A i used one of the PWM's to provide a usable input source... TMR is used to calculate RPM based on software triggerging...

The bit thats confused me is internal clock FOSC...
Is FOSC the 24mhZ HS XTAL

or

Is it the derived 48MHz?

OR

Is it the onboard oscilator?

Selecting clock sources has confused the hell out of me between internal and external clocks... Acording to the datasheet, TMR1 has a 32KHz on chip oscilator... but i can only find reference to adding a 32KHz LP xtal... :confused: :eek: :confused:

Also, is the TMR1 prescaler, a multiply or devide? Looks like multiply to me...

I'd like tmr1 to have a 32Khz clock from it's internals without having to add on another xtal...

Darrel Taylor
- 27th September 2009, 20:42
The oscillators on the USB chips are extremely versatile.
You could do all the things you suggested.

With a 24Mhz crystal ...
You can have both the USB module and the CPU running from 48Mhz.
Or the CPU could be at 24, 12, 8 or 4 Mhz while the USB still gets 48.

You could also run the CPU from the internal oscillator at 8Mhz, while the USB module gets 48 Mhz from a 4Mhz crystal.

So many options you can't list them all.


I'd like tmr1 to have a 32Khz clock from it's internals without having to add on another xtal...
Now that ... you can't do.
But you can use the FOSC/4 from the CPU's clock.
Not as accurate as a Watch Crystal, especially when running at 48Mhz.

However, you'll need PBP 2.46 or higher to use 18F4550's with USB.
<br>

comwarrior
- 7th October 2009, 00:06
Ahh foo!

Thanks Darrel