|
|
View previous topic :: View next topic |
Author |
Message |
pfournier
Joined: 30 Sep 2003 Posts: 89
|
#use delay() differences compared to just fuses |
Posted: Fri May 02, 2014 1:51 pm |
|
|
18F87j50
CCS compiler 5.025
I had an issue with some code where changing the processor speed would give the the wrong baud rate (and timer rate).
I finally built a very simple led flasher with RS232 printf statements.
I used the wizard and found it created a statement:
Code: | #use delay(clock=48000000,oscillator=12000000)
|
and the code worked!
If I used:
Code: |
#fuses PLL3, NOCPUDIV, ECPLL
#use delay(clock=48000000)
|
and the code did NOT work.
The fuses as shown in the LST file were identical, but there were code differences.
Code: |
Configuration Fuses:
Word 1: F7AA NOWDT PLL3 STVREN NOXINST NODEBUG NOCPUDIV NOPROTECT
Word 2: F7C7 ECPLL FCMEN IESO WDT128
Word 3: FFF8 EASHFT MCU BW16 NOWAIT CCP2C1 ECCPE PMPEMB MSSPMSK7
|
While I could probably figure out the purpose of the differences, given enough time, I was hoping someone would know what the additional code does, and how, if not for accidentally finding this use delay option, I would never have known this.
Now I could swear this worked ok when I was using version 4.xxx, but I will have to take a trip down memory lane to check that out. _________________ -Pete |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Sat May 03, 2014 12:22 am |
|
|
You'll find the extra code, is the equivalent of adding 'setup_oscillator(OSC_NORMAL)'.
This type of behaviour is getting more common (especially on the PIC24's), where as well as setting the fuses, there has to be a configuration of some registers to setup the clock. The extended clock statement, tries (for instance) to setup the PLL used on these, while the simpler clock statement leaves this unconfigured.
Generally, on the later compilers it is safer to use the extended clock setup, and only get involved in the manual clock fuses if this doesn't work right.
Best Wishes |
|
|
|
|
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
|