I hope I am doing this right, signing up and posting a question right away
:)

So I have this little test program, My first c program for a PIC. It
assembles and runs fine if I comment out the OSCTUNEbits.PLLEN. I have tried
several examples of setting OSCTUNE and OSCCON bits and sdcc always exits
with status: 1.
I also can not get in line assembler working via _asm _endasm for performing
the same task (bumping the frequency to 32MHz).
Anyone have a clue as to why these portions of code are not being friendly
to sdcc?
I've tried placing that portion of code directly above the TRISCbits section
and still nothing. The PIC always runs at 1MHz, the default.

Thanks for any help.


/* -----------------------------------------------------------------------
*/
/* Template source file generated by piklab */
#include <pic18fregs.h>
/* -----------------------------------------------------------------------
*/
/* Configuration bits: adapt to your setup and needs */
code char at __CONFIG1H CONFIG1H = _OSC_INTIO7_1H & _FCMEN_OFF_1H &
_IESO_OFF_1H;
code char at __CONFIG2L CONFIG2L = _PWRT_OFF_2L & _BOREN_SBORDIS_2L &
_BORV_3_2L;
code char at __CONFIG2H CONFIG2H = _WDT_ON_2H & _WDTPS_32768_2H;
code char at __CONFIG3H CONFIG3H = _CCP2MX_PORTC_3H & _PBADEN_ON_3H &
_LPT1OSC_OFF_3H & _MCLRE_ON_3H;
code char at __CONFIG4L CONFIG4L = _STVREN_ON_4L & _LVP_ON_4L &
_XINST_OFF_4L & _DEBUG_OFF_4L;
code char at __CONFIG5L CONFIG5L = _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L &
_CP3_OFF_5L;
code char at __CONFIG5H CONFIG5H = _CPB_OFF_5H;
code char at __CONFIG6L CONFIG6L = _WRT0_OFF_6L & _WRT1_OFF_6L &
_WRT2_OFF_6L & _WRT3_OFF_6L;
code char at __CONFIG6H CONFIG6H = _WRTC_OFF_6H & _WRTB_OFF_6H;
code char at __CONFIG7L CONFIG7L = _EBTR0_OFF_7L & _EBTR1_OFF_7L &
_EBTR2_OFF_7L & _EBTR3_OFF_7L;
code char at __CONFIG7H CONFIG7H = _EBTRB_OFF_7H;



    //OSCCON=0x70;
    //IRFC0 = 1;
    OSCTUNEbits.PLLEN    = 1;

void main()
{


    int RISING_EDGE_COUNTER = 0;
    int RISING_EDGE_FLAG = 1;

    TRISCbits.TRISC0 = 1;
    TRISCbits.TRISC1 = 0;
    TRISCbits.TRISC3 = 0;


while(1)
  {
  if (PORTCbits.RC0 == 0)
    {
    PORTCbits.RC3 = 0;
    PORTCbits.RC1 = 0;
    RISING_EDGE_FLAG=0;
    }
  if (PORTCbits.RC0 != 0)
    {
    PORTCbits.RC3 = 1;
    PORTCbits.RC1 = 1;
      if(RISING_EDGE_FLAG==0)
      {
       RISING_EDGE_COUNTER++;
       RISING_EDGE_FLAG=1;
     }

    }

  }
}
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to