View previous topic :: View next topic |
Author |
Message |
guest Guest
|
Writing the Config1h Register on the PIC18F2580 |
Posted: Wed Oct 04, 2006 5:06 pm |
|
|
I am attempting to write 0110 to the Fosc3:Fosc0 bits in the Config1h register of my PIC18F2580 to enable external crystal PLL mode. In the manual on page 345 it details how to do this, but I am not completely sure how to directly write registers outside of using the #byte directive (maybe this is how I need to do it?). Setting these bits requires a special procedure similar to "programming the flash memory" according to the manual so I was wondering if someone had done this before and could give some guidance (and maybe a code snippet). Anyone able to give me some tips? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 04, 2006 5:38 pm |
|
|
Use the #fuses statement. Look near the top of the 18F2580.H file
for a list of settings that you can use.
Example:
Code: |
#include <18F2580.h>
#fuses H4,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=40000000) // 10 MHz crystal x 4 = 40 MHz
|
Note that the power must be cycled after you program the PIC,
in order for the PLL mode to take effect. |
|
|
Bryan
Joined: 23 Apr 2005 Posts: 73
|
|
Posted: Wed Oct 04, 2006 5:58 pm |
|
|
Is H4 fuse the HSPLL setting as described in the data sheet? Sorry, I accidentally posted as guest before, but the first post was mine as well. I still haven't been able to find a listing of what each fuse means - is this listed somewhere? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 04, 2006 7:06 pm |
|
|
Yes, H4 is the same as HSPLL for that PIC.
Here's the thread on #fuses.
http://www.ccsinfo.com/forum/viewtopic.php?t=24336
Humberto shows a list of fuses with explanations. I'm not sure where
that comes from. I don't know if he created it or if PCWH created it.
I do know that if you go to the View menu in the IDE and select the
"Valid Fuses" menu, you'll get a pop-up window. Then select your PIC
in the drop-down box, and you'll see a list of fuses with an explanation
next to each one. (This is for PCWH vs. 3.249. I looked at the demo). |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Oct 05, 2006 5:56 am |
|
|
Quote: | Humberto shows a list of fuses with explanations. I'm not sure where
that comes from. I don't know if he created it or if PCWH created it. | It looks like an abstract from the file fuses.txt in the compiler directory. |
|
|
|