PDA

View Full Version : Separate fuse configs for each MCU type during programming?



blainecf
- 19th June 2006, 19:28
I'm hoping this already exists. (BTW, I read all the readme and help files before posting, so I tried to find the answer before coming here).

I'm using the USB programmer (love it!).

However, I'm working on multiple projects that use different MCU models. I need some way to save the fuse configuration for each MCU, so that I don't have to manually change these each time I switch MCU's.

If no way to save and recall multiple configurations, then any way to embed settings into the code so the programmer can pick them out of the code?

I wasted an hour yesterday because I switched to a different MCU and had the previous MCU's fuse config.

SINCERELY,

bcf

Bruce
- 19th June 2006, 20:03
Hi Blaine,

See this post by Melanie http://www.picbasic.co.uk/forum/showthread.php?t=543&highlight=config+fuses

blainecf
- 19th June 2006, 20:20
My preliminary look leads me to a simple question: Does the programmer "pick up these settings and burn them once" or will the program re-burn the settings every time it runs.

This may be ultimately irrelevant, but it seems to me if the fuses were re-burnt every time the program runs, it would be hard on the fuses. But, if the fuses are "made of the same stuff that memory is made of" then it doesn't matter at all.

Thanks again to all!

Bruce
- 19th June 2006, 20:26
With the MeLabs USB programmer, if you have "Reread File Before Programming" and "Update Configuration From File" selected under the Options menu, then it will reload & program whatever config fuse settings are embedded in your .hex file each time.

blainecf
- 19th June 2006, 20:29
Thanks so much for your help.

blainecf
- 28th June 2006, 22:32
I struggled with this for quite a while; the 18xxxx series works a little different. You can't use the __CONFIG command, and I could never get it to work embedding the @ CONFIG command in the source code (because the include code has some __CONFIG lines in it already, and you CAN'T MIX the two types of config methods, according to the compiler).


In your program, put this line at the top (according to your processor type!)

@ #INCLUDE <18F4550.INC>


Then, edit that include so that it looks like this (customize according to your needs):

NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F4550, r = dec, w = -311, f = inhx32
INCLUDE "P18F4550.INC" ; MPASM Header
; NOTE: these are the lines you will add, according to your needs and
; the device spec sheet
; If there are any __CONFIG lines, delete them!
CONFIG PLLDIV = 5
CONFIG CPUDIV = OSC3_PLL4
CONFIG USBDIV = 2
CONFIG FOSC = HSPLL_HS
CONFIG FCMEM = ON
CONFIG PWRT = ON
CONFIG BOR = ON
CONFIG BORV = 43
CONFIG VREGEN = ON
CONFIG WDT = OFF
CONFIG WDTPS = 1024
CONFIG MCLRE = ON
CONFIG PBADEN = OFF

NOLIST
endif
LIST

... (the rest of the include code)


I keep each project in it's own folder, then copy the includes needed into that folder.

Best wishes!