|
|
View previous topic :: View next topic |
Author |
Message |
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. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|