Another approach is to simply put your config in a separate C file and then 
just link that in.  Keeps your source a little more readable.  Indeed, you 
can even link in an asm file with nothing but the fuses.  (IMO, the ASM is 
more readable in this case.)

72/73 de WB8RCR    http://www.qsl.net/wb8rcr
didileydadidah     QRP-L #1446 Code Warriors #35

----- Original Message ----- 
From: Alexandre Martins
To: [email protected]
Sent: Thursday, January 22, 2009 6:24 PM
Subject: [Sdcc-user] PIC18F4550 HEX file created don't work - SOLVED


Hi everybody,

I'd like to thank all your posts on this topic (PIC18F4550 HEX file created 
don't work).

I've already solved this problem. So I'll explain how to.

I'm using Piklab IDE on Ubuntu 8.10 and ICD 2 Programmer - works well. The 
problem was on the fuses configuration. When we build a project on Piklab 
using Small Device C Compiler there's no fuses configuration generated - 
fuses are default configured. So I found a way in Piklab to do that, goes 
likes this:
Select Tools > Config Generator...
This will open a "Config Generator" window where we can select the desired 
device and configure its fuses. After that we can select "Copy to Clipboard" 
button and paste the fuses configuration in the C code file (after 
includes). For the exampled I've listed before, my chosen fuses for 
PIC18F4550 on the referred window generated the follow code:

code char at __CONFIG1L CONFIG1L = _PLLDIV_NO_DIVIDE__4MHZ_INPUT__1L & 
_CPUDIV__OSC1_OSC2_SRC___1__96MHZ_PLL_SRC___2__1L & 
_USBPLL_CLOCK_SRC_FROM_OSC1_OSC2_1L;
code char at __CONFIG1H CONFIG1H = _OSC_XT__USB_XT_1H & _FCMEN_OFF_1H & 
_IESO_ON_1H;
code char at __CONFIG2L CONFIG2L = _PUT_OFF_2L & _BODEN_OFF_2L & 
_BODENV_2_0V_2L & _VREGEN_OFF_2L;
code char at __CONFIG2H CONFIG2H = _WDT_DISABLED_CONTROLLED_2H & 
_WDTPS_1_32768_2H;
code char at __CONFIG3H CONFIG3H = _CCP2MUX_RC1_3H & 
_PBADEN_PORTB_4_0__CONFIGURED_AS_ANALOG_INPUTS_ON_RESET_3H & _LPT1OSC_OFF_3H 
& _MCLRE_MCLR_ON_RE3_OFF_3H;
code char at __CONFIG4L CONFIG4L = _STVR_OFF_4L & _LVP_OFF_4L & 
_ENICPORT_OFF_4L & _ENHCPU_OFF_4L & _BACKBUG_OFF_4L;
code char at __CONFIG5L CONFIG5L = _CP_0_OFF_5L & _CP_1_OFF_5L & 
_CP_2_OFF_5L & _CP_3_OFF_5L;
code char at __CONFIG5H CONFIG5H = _CPB_OFF_5H;
code char at __CONFIG6L CONFIG6L = _WRT_0_OFF_6L & _WRT_1_OFF_6L & 
_WRT_2_OFF_6L & _WRT_3_OFF_6L;
code char at __CONFIG6H CONFIG6H = _WRTC_OFF_6H & _WRTB_OFF_6H;
code char at __CONFIG7L CONFIG7L = _EBTR_0_OFF_7L & _EBTR_1_OFF_7L & 
_EBTR_2_OFF_7L & _EBTR_3_OFF_7L;
code char at __CONFIG7H CONFIG7H = _EBTRB_OFF_7H;

Now the LED is blinking ;)

There is a remaining fault -> it takes over 20 seconds to start blinking.

Thanks for everything. Greetings.



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword



_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user 


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to