Hi,

I have tried to compile Jan's code in terminal and got the following printout instead. I'm having a feeling that SDCC isn't recompiled properly on my computer.

prak@prak-laptop:/media/sda5/Dairy Cow Research/datalogging scale/software/LED_toggle$ sdcc main.c
main.c:1:24: pic18fregs.h: No such file or directory
main.c:4: error 20: Undefined identifier '__CONFIG1H'
main.c:4: error 2: Initializer element is not constant
main.c:5: error 20: Undefined identifier '__CONFIG2L'
main.c:5: error 2: Initializer element is not constant
main.c:6: error 20: Undefined identifier '__CONFIG2H'
main.c:6: error 2: Initializer element is not constant
main.c:7: error 20: Undefined identifier '__CONFIG3H'
main.c:7: error 2: Initializer element is not constant
main.c:8: error 20: Undefined identifier '__CONFIG4L'
main.c:8: error 2: Initializer element is not constant
main.c:9: error 20: Undefined identifier '__CONFIG5L'
main.c:9: error 2: Initializer element is not constant
main.c:10: error 20: Undefined identifier '__CONFIG5H'
main.c:10: error 2: Initializer element is not constant
main.c:11: error 20: Undefined identifier '__CONFIG6L'
main.c:11: error 2: Initializer element is not constant
main.c:12: error 20: Undefined identifier '__CONFIG6H'
main.c:12: error 2: Initializer element is not constant
main.c:13: error 20: Undefined identifier '__CONFIG7L'
main.c:13: error 2: Initializer element is not constant
main.c:14: error 20: Undefined identifier '__CONFIG7H'
main.c:14: error 2: Initializer element is not constant
main.c:18: error 20: Undefined identifier 'OSCCON'
main.c:18: error 103: code not generated for 'init_cpu' due to previous errors

Stanley

On 9/12/07, sdcc@dummgebabbel.de <sdcc@dummgebabbel.de> wrote:
Stanley Lee schrieb:
> Hi,
>
> Below is a sample code that's supposed to flash 8 LEDs on port b at 5
> Hz. I have modified the .h file to correspond to the one included in the
> latest SDCC snapshot. However, I'm not sure how to change the "#pragma
> config..." line to correspond to the same command in SDCC. That
> particular line is for MPLAB C18 C compiler. Can someone lend me a hand
> on how to get started with regards to dealing with that line?

Here are my config line for an pic18f2220. It uses the internal
oscilator with 8MHz, disables WDT, and uses MCLR as an input pin.


#include <pic18fregs.h>

// Set the __CONFIG words:
code char at __CONFIG1H _conf0 = _OSC_INT_Port_on_RA6_Port_on_RA7_1H;
code char at __CONFIG2L _conf1 = _BODEN_OFF_2L;
code char at __CONFIG2H _conf2 = _WDT_DISABLED_CONTROLLED_2H;
code char at __CONFIG3H _conf3 = _MCLRE_MCLR_disabled_RA5_input_en_3H;
code char at __CONFIG4L _conf4 = _LVP_OFF_4L;
code char at __CONFIG5L _conf5 = _CP_0_OFF_5L & _CP_1_OFF_5L;
code char at __CONFIG5H _conf6 = _CPD_OFF_5H & _CPB_OFF_5H;
code char at __CONFIG6L _conf7 = _WRT_0_OFF_6L & _WRT_1_OFF_6L;
code char at __CONFIG6H _conf8 = _WRTD_OFF_6H & _WRTB_OFF_6H & _WRTC_OFF_6H;
code char at __CONFIG7L _conf9 = _EBTR_0_OFF_7L & _EBTR_1_OFF_7L;
code char at __CONFIG7H _conf10 = _EBTRB_OFF_7H;

void init_cpu() {
  /* INT Osc with 8MHz */
  OSCCON = 0x70;        /* 01110000 */
}

hope this helps

jan




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user