hello
I have an oscillator problem with the PIC18F26J50 I can't get the 48Mhz.
12Mhz crystal divider by 3 with PLL is running way too slow. 1Sek clock is not possible.
I need a good tip
PIC18F26J50 Oscilator Problem 48Mhz
-
- Posts: 261
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 686 times
Re: PIC18F26J50 Oscilator Problem 48Mhz
Hello,
Your settings look largely correct to me, One thing to try is enabling the "Internal External Oscillator Switch Over Mode" setting in config word 0x02.
Also in project options under Other Options you have Auto Clear watchdog set but the watchdog is diabled in the chip config, this shouldn't really effect things too much but if you're not using the watchdog then it makes sense to disable this feature, saves you a bit of ROM/Runtime hit.
Your settings look largely correct to me, One thing to try is enabling the "Internal External Oscillator Switch Over Mode" setting in config word 0x02.
Also in project options under Other Options you have Auto Clear watchdog set but the watchdog is diabled in the chip config, this shouldn't really effect things too much but if you're not using the watchdog then it makes sense to disable this feature, saves you a bit of ROM/Runtime hit.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: PIC18F26J50 Oscilator Problem 48Mhz
Hello Ben
I have to set a delay of 960msek to get to one second on and off.
the PIC18F24-26J50 all do this in the same way.
a delay of one second is too long.
If I program a delay of 960msek then I get to one second.
please check once
I have to set a delay of 960msek to get to one second on and off.
the PIC18F24-26J50 all do this in the same way.
a delay of one second is too long.
If I program a delay of 960msek then I get to one second.
please check once
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 686 times
Re: PIC18F26J50 Oscilator Problem 48Mhz
Hello,
If you need bang on accurate timing you would be better off using a timer interrupt as this will accurately count instruction cycles. The timer interval component may help here.
For the software based delays used in the delay icons they are usually designed to produce a delay that is >= the delay requested.
This is the delay second code, you can see each loop and subroutine call will add a little overhead. It's done like this because the compiler has a maximum amount of delay it can produce in one go.
If you like I can have another pass over the delay code and see if I can improve the timings a bit, it's been a while since I last went through this code.
Things that could be further effecting the software delay...
1. Do you have auto clear watchdog timer switched on in the project options?
2. Do you have any interrupts active?
If you need bang on accurate timing you would be better off using a timer interrupt as this will accurately count instruction cycles. The timer interval component may help here.
For the software based delays used in the delay icons they are usually designed to produce a delay that is >= the delay requested.
This is the delay second code, you can see each loop and subroutine call will add a little overhead. It's done like this because the compiler has a maximum amount of delay it can produce in one go.
Code: Select all
void delay_ms(MX_UINT8 del)
{
while (del--)
{
__delay_ms(1);
}
}
void delay_s(MX_UINT8 del)
{
MX_UINT8 i;
for(i=0; i<del; i++)
{
delay_ms(250);
delay_ms(250);
delay_ms(250);
delay_ms(250);
}
}
Things that could be further effecting the software delay...
1. Do you have auto clear watchdog timer switched on in the project options?
2. Do you have any interrupts active?
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: PIC18F26J50 Oscilator Problem 48Mhz
Hi Ben,
Things that might affect the software delay further....
1. have you set the watchdog timer to auto clear in the project options?
I have turned it off.
2. do you have any interrupts active?
I don't use them.
this is the first time i noticed that the delay has only about 1 sec.
is this not so noticeable with the PIC32?
I need exactly 10 minutes.
I will program an interrupt for that.
Thank you for this clarification.
Things that might affect the software delay further....
1. have you set the watchdog timer to auto clear in the project options?
I have turned it off.
2. do you have any interrupts active?
I don't use them.
this is the first time i noticed that the delay has only about 1 sec.
is this not so noticeable with the PIC32?
I need exactly 10 minutes.
I will program an interrupt for that.
Thank you for this clarification.