View previous topic :: View next topic |
Author |
Message |
mose
Joined: 26 Nov 2011 Posts: 4 Location: Denmark
|
ERROR: Option invalid No PLL, after updating CCS to 4.127 |
Posted: Sat Nov 26, 2011 12:35 pm |
|
|
Hi,
An old program can no longer be build, when tried with CCS version 4.127
I have boiled the problem down to this: (we use an external oscillator)
old program work like this.
Code: |
#include <18F25k20.h>
#fuses H4,NOWDT,NOLVP
#use delay(oscillator=10M,clock=40M)
void main() {}
|
with CCS V4.127 we get the error *** Error 99 "slet.c" Line 6(5,37): Option invalid No PLL
if I use crystal instead of oscillator, the program builds, and the program runs fine.
#use delay(crystal=10M,clock=40M)
But why can't we no longer write oscillator?
Do I need to worry if the setup still runs stable for years, with the crystal setting?
/Mose |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Nov 26, 2011 2:41 pm |
|
|
Quote: | Do I need to worry if the setup still runs stable for years, with the crystal setting? |
Don't worry, but be aware of arbitrary option syntax changes with the next compiler version. And don't ask why. |
|
|
mose
Joined: 26 Nov 2011 Posts: 4 Location: Denmark
|
|
Posted: Sat Nov 26, 2011 2:54 pm |
|
|
Thanks for the answer
I am also wondering if it indeed is true that CCS change the syntax for #delay statements. without clearly drive attentions to this.
and further more why force programmers to write crystal, when they uses oscillators?
even their help file have the following line as an example.
"
//application is using a 10Mhz oscillator, but using the 4x PLL
//to upscale it to 40Mhz. Compiler will set H4 config bit.
#use delay(clock=40M, oscillator=10M)
"
but copy paste this into MPlab, and the error occurs.
their own help file is not updated then - or am I still missing something?
/mose |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Nov 26, 2011 3:20 pm |
|
|
you fuses statement is awfully sparse and leaves a lot up to chance
what happens if you change the line to THIS:
Code: |
#fuses HS,H4,NOWDT,NOLVP,PUT, NOBROWNOUT,NOMCLR
|
|
|
|
mose
Joined: 26 Nov 2011 Posts: 4 Location: Denmark
|
|
Posted: Sat Nov 26, 2011 3:28 pm |
|
|
Sorry for not explaning propperly
but the lines, from the posted example program, is in no way close to the real program.
I just wrote the program example as short as possible to show the problem.
Any how,
your proposal to more fuses made no change.
still getting the error: *** Error 99 "slet.c" Line 8(5,37): Option invalid No PLL
when using: #use delay(oscillator=10M,clock=40M) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Nov 26, 2011 3:42 pm |
|
|
I'm not at a location today where I can test this in hardware, or even with
the latest version, but try this code. I think it has a good chance to work.
Code: |
#include <18F25K20.h>
#fuses H4,NOWDT,NOLVP,BROWNOUT,PUT,NOPBADEN
#use delay(clock=40M)
//===========================================
void main()
{
while(1) // Toggle LED at 1 Hz rate
{
output_toggle(PIN_B0);
delay_ms(500);
}
} |
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Nov 26, 2011 4:22 pm |
|
|
Quote: | try this code. I think it has a good chance to work. |
Yes. If you specify H4, you don't need (oscillator=10M,clock=40M) respectively (crystal=10M,clock=40M). The #delay syntax has been apparently intended as an alternative to explicite PLL fuses. Both methods work.
You may recognize an adavantage of the #use delay PLL specification when using a device that supports various clock multiply rates, not only fixed factor 4.
The problem is, that CCS abandoned once more a previously working syntax. |
|
|
mose
Joined: 26 Nov 2011 Posts: 4 Location: Denmark
|
|
Posted: Sat Nov 26, 2011 5:41 pm |
|
|
@PCM programmer
Your code works.
I have tried the delay without either oscillator or crystal. But that just didn't make sense to me, that none was needed all of a sudden.
@FvM
You are right that since the PLL is fixed, they can very well come to the conclusion that all will be easier without oscillator / crystal in the delay line.
But I just prefer if CCS clearly state how their syntax is intended to work, especially when they change a working syntax to something new. - otherwise it hard to trust ones code to work properly under all conditions.
In general I just prefer to be sure, and when even the help file examples didnt work, I went for help...
Thanks for your help and answers. |
|
|
|