PDA

View Full Version : Help with config fuse?



polymer52
- 25th December 2009, 17:15
I'm confused about the config or fuses or whatever they are. Doesn't the @ mean that an asm code follows?
Do I always need to include the IC file? Like 12F675.inc?
I've seen some done in caps and some not. The PBP manual mentioned something about different assemblers needing caps.
Also some are entered in a single line like this:

@ DEVICE pic12f675, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off

and some on individual lines like this:

@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
@ DEVICE pic16F628, WDT_ON
@ DEVICE pic16F628, PWRT_ON
@ DEVICE pic16F628, MCLR_OFF
@ DEVICE pic16F628, BOD_ON
@ DEVICE pic16F628, LVP_OFF
@ DEVICE pic16F628, CPD_OFF
@ DEVICE pic16F628, PROTECT_OFF

Does it matter which I use?

mackrackit
- 25th December 2009, 21:49
http://www.picbasic.co.uk/forum/showthread.php?t=543

when setting the fuses in code space you will need to comment a couple lines in the PIC's Inc file. While you are doing that look at how the fuses are set(single line, double line). Simetimes it does not matter but sometimes it does. Depends on the PIC.

So looking at how it is done in the Inc is the best way to know.

jellis00
- 27th December 2009, 02:48
I'm confused about the config or fuses or whatever they are.

I too had problems assimilating how to best define the config settings in my code when I was new to PicBasic. Of the many suggestions I received from members of this forum, the one that stuck with me as the best way is as shown in the following example, where the config settings are part of an assembly list of statements. By going to the data sheet for the PIC you are using, you can find how to define these statements...these in this example are for an 18F4550, including alternative methods using @ config or
@ _config statements:

;--- if you un-comment these, you must comment the ones in the .inc file--
ASM ; 18F2550/4550, 8mhz crystal
__CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
' If 16F877 MCU used, use this config
'@ config XT_osc, wdt_off, pwrt_on, protect_off
' or
'@ _CONFIG _CONFIG1H,_OSCS_OFF_1H & _HS_OSC_1H

polymer52
- 27th December 2009, 11:51
http://www.picbasic.co.uk/forum/showthread.php?t=543

when setting the fuses in code space you will need to comment a couple lines in the PIC's Inc file. While you are doing that look at how the fuses are set(single line, double line). Simetimes it does not matter but sometimes it does. Depends on the PIC.

So looking at how it is done in the Inc is the best way to know.

So if I add the comments in the program I need to comment out everything in the inc file OR make a backup and just change the inc file and leave it out of the program?

mackrackit
- 27th December 2009, 17:15
Only comment out the lines in the inc file that have to do with the configs(fuses). The other stuff is still needed.

Yes or. If you do not plan on changing the settings often the just modify the inc.

polymer52
- 27th December 2009, 21:14
Only comment out the lines in the inc file that have to do with the configs(fuses). The other stuff is still needed.

Yes or. If you do not plan on changing the settings often the just modify the inc.

Thanks to all.