How do I configure fuse settings in SF? I tried the way I've been doing it in Picbasic Pro but can't seem to get it to work. I have just started playing with a 18F1320 for practice and would like to set the osc type etc.
Thanks
Fuse Settings
Moderators: David Barker, Jerry Messina
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
The documentation on this is a little lacking. I will try and get something on the wiki soon. Anyway, here is a crash course...
A useful technique to see what fuse settings are available for your particular device is to open the swordfish device system file. For example, if your program has
then just click on the '18F1320' node in the explorer window to open the file. If you scroll down, you will see the following
These are the options available to you. Lets take one example, OSC.
You can see a little further down that the 'default' has been set to HS
So if you build you program, the above default setting will be used. You don't need to set them again. To change a fuse setting, just use the config keyword in your program. For example,
In the above example, OSC has now been set to HSPLL and BOR has been disabled. As you can see, you just simply override the settings in your program. You don't need any ASM or have to edit the system file.
Jack Smith has been posting a DDS article on the wiki. If you scroll down the page, you will see some sample code and detailed explanations on setting the configuration fuses using swordfish...
http://www.sfcompiler.co.uk/wiki/pmwiki ... shUser.DDS
A useful technique to see what fuse settings are available for your particular device is to open the swordfish device system file. For example, if your program has
Code: Select all
device = 18F1320
Code: Select all
// configuration fuses...
public config
OSC(OSC) = [LP, XT, HS, EC, ECIO, HSPLL, RCIO, INTIO2, INTIO1, RC],
FSCM(FSCM) = [OFF, ON],
IESO(IESO) = [OFF, ON],
PWRT(PWRT) = [ON, OFF],
BOR(BOR) = [OFF, ON],
BORV(BORV) = [45, 42, 27, 20],
WDT(WDT) = [OFF, ON],
WDTPS(WDTPS) = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768],
MCLRE(MCLRE) = [OFF, ON],
STVR(STVR) = [OFF, ON],
LVP(LVP) = [OFF, ON],
DEBUG(DEBUG) = [ON, OFF],
CP0(CP0) = [ON, OFF],
CP1(CP1) = [ON, OFF],
CPB(CPB) = [ON, OFF],
CPD(CPD) = [ON, OFF],
WRT0(WRT0) = [ON, OFF],
WRT1(WRT1) = [ON, OFF],
WRTB(WRTB) = [ON, OFF],
WRTC(WRTC) = [ON, OFF],
WRTD(WRTD) = [ON, OFF],
EBTR0(EBTR0) = [ON, OFF],
EBTR1(EBTR1) = [ON, OFF],
EBTRB(EBTRB) = [ON, OFF]
Code: Select all
OSC(OSC) = [LP, XT, HS, EC, ECIO, HSPLL, RCIO, INTIO2, INTIO1, RC]
Code: Select all
// default fuses...
config
OSC = HS,
IESO = OFF,
PWRT = ON,
BOR = ON,
BORV = 20,
WDT = OFF,
WDTPS = 128,
STVR = ON,
LVP = OFF,
DEBUG = OFF
Code: Select all
device = 18F1320
config
OSC = HSPLL,
BOR = OFF
include "usart.bas"
...
Jack Smith has been posting a DDS article on the wiki. If you scroll down the page, you will see some sample code and detailed explanations on setting the configuration fuses using swordfish...
http://www.sfcompiler.co.uk/wiki/pmwiki ... shUser.DDS