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 */

On Sun, Apr 17, 2011 at 11:57 PM, Rob Connolly <rob.conno...@hmi.co.nz> wrote:
> 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

Reply via email to