News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

declaration of fraction of crystal frequenciy

Started by Yves, Feb 12, 2022, 05:13 PM

Previous topic - Next topic

Yves

Hello all,

Is it possible to declare a xtal value which is not an integer value. for example "Declare Xtal = 32.768"

Regards,

Yves
Yves

trastikata

Hi Yves,

As far as I know, you can't. You have to declare something else and recalculate your delays and/or timings accordingly. 



QuoteOscillator Frequency Declare.
12-bit core device XTAL values:
Declare Xtal = 4, 8, 10, 12, 16, or 20.
Standard 14-bit core device XTAL values:
Declare Xtal = 3, 4, 7, 8, 10, 12, 14, 16, 19, 20, 22, or 24.
Enhanced 14-bit core device XTAL values:
Declare Xtal = 3, 4, 7, 8, 10, 12, 14, 16, 19, 20, 22, 24, 32, 48, or 64.
18F device XTAL values:
Declare Xtal = 3, 4, 7, 8, 10, 12, 14, 16, 19, 20, 22, 24, 25, 29, 32, 33, 40, 48, 64, 80, or 88.

The Xtal frequencies 3, 7, 14, 19 and 22 are for 3.58MHz, 7.2M Hz, 14.32MHz, 19.66MHz,
22.1184MHz and 29.2MHz respectively.

Yves

Tank you for your information. So does it means any other values mentioned above will not gives the proper timing. I was thinking about baud rates timing?

Yves
Yves

trastikata

Quote from: Yves on Feb 13, 2022, 08:38 AMSo does it means any other values mentioned above will not gives the proper timing. I was thinking about baud rates timing?

Indeed they won't - they will affect any time related commands, like DelayMS. As for the baud rate - you can manually calculate and set-up the corresponding registers/values before start using the serial transfer commands.