Hi Fabien, After a bit more research I have found that the following appears to work:
__code __at __CONFIG1L _C1L = 0x20; __code __at __CONFIG1H _C1H = 0x04; __code __at __CONFIG2L _C2L = 0x04 & 0x01; __code __at __CONFIG2H _C2H = 0x0C; __code __at __CONFIG3L _C3L = 0x30 & 0x40; __code __at __CONFIG3H _C3H = 0x07; I haven't been able to read back the configuration bits fully yet, but verifying through piklab-prog indicates that they are being set to those included in the hex file. HTH, Rob ________________________________________ From: Olgierd Eysymontt [oec...@eid.cl] Sent: 19 April 2011 09:20 To: sdcc-user@lists.sourceforge.net Subject: Re: [Sdcc-user] PIC18F97J60 configuration bits... Fabien, It seems that the 18f4550 has the CONFIG_1L, CONFIG_1H .. etc. address macros defined, but in the pic18fxxJxx series, they are not defined in the processor include file. These can be added by hand, not a problem, but I've tried a manual approach using the datasheet address without results, my HEX files never include the information. ¿ Have anybody worked with J series and make the config words work ? Regards Olgierd On 18-04-2011 1:35, lementec fabien wrote: > Hi, > > Here is how I do the job for a pic18f4550 using the > device specs to know the hex values of the config > bits: > > #ifndef CONFIG_H_INCLUDED > # define CONFIG_H_INCLUDED > > # define CONFIG(k, n) code static char at __ ## k _ ## k = n > > /* bits value meaning > 5 0 clock comes from the primary osc block, no prescale > 4-3 3 system clock postscaler (none) > 2-0 0 prescaler (none) > */ > > CONFIG(CONFIG1L, 0x10); > > /* bits value meaning > 7 0 osc switchover mode disabled > 6 0 failsafe clock mon disabled > 3-0 a osc selection: internal osc used, usb use xt > */ > > CONFIG(CONFIG1H, 0x0a); > > CONFIG(CONFIG2L, 0x00); > > /* bits value meaning > 0 0 wdt disabled > */ > > CONFIG(CONFIG2H, 0x00); > > /* bits value meaning > 1 0 portb<4:0> are digital io > 0 1 ccp2 mx with rc1 > */ > > CONFIG(CONFIG3H, 0x01); > > /* bits value meaning > 7 1 background debugger disabled (rb6,7 are general io pins) > 6 0 extended instruction disabled > */ > > CONFIG(CONFIG4L, 0x80); > > #endif /* ! CONFIG_H_INCLUDED */ > > 2011/4/17 Rob Connolly<rob.conno...@hmi.co.nz>: >> Hi Everyone, >> >> I'm trying to get a simple program running on one of our firms development >> boards using SDCC, however I'm having problems setting the configuration >> bits. The board uses a PIC18F97J60 chip. >> >> There seems to be some differing ways of setting these bits throughout other >> posts around the internet. So far the best I've come up with is: >> >> __code __at 0x1FFF8 __CONFIG = _EXTCLK_OSC& _WDT_OFF& _LVP_OFF& >> _DATA_CP_OFF& _PWRTE_ON; >> >> However, this tells me that several of the macros are not defined: >> >> hello_led.c:12: error 20: Undefined identifier '_EXTCLK_OSC' >> hello_led.c:12: error 20: Undefined identifier '_WDT_OFF' >> hello_led.c:12: error 20: Undefined identifier '_LVP_OFF' >> hello_led.c:12: error 20: Undefined identifier '_DATA_CP_OFF' >> hello_led.c:12: error 20: Undefined identifier '_PWRTE_ON' >> >> And indeed if I look in pic18f96j60.h (which is included from pic18f97j60.h) >> there are no macros for configuration bits. >> >> So, my question is, what is the best way to go about this? >> >> Thanks in advance, >> >> Rob Connolly, BE >> HMI Technologies Ltd. >> ------------------------------------------------------------------------------ >> Benefiting from Server Virtualization: Beyond Initial Workload >> Consolidation -- Increasing the use of server virtualization is a top >> priority.Virtualization can reduce costs, simplify management, and improve >> application availability and disaster protection. Learn more about boosting >> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev >> _______________________________________________ >> Sdcc-user mailing list >> Sdcc-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/sdcc-user >> > > ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user