示例#1
0
/*------------------------------------------------------------------------------
 *                                  PPC RESET
 *------------------------------------------------------------------------------
 * Description        : Software resets the PIC
 * Arguments          : None
 * Return Value       : int: 1=Always successfull
 *----------------------------------------------------------------------------*/
int ppc_reset(void* param)
{
    int arg = *((int *)param);
    sw_reset(arg);
    
    return 1;
}
示例#2
0
文件: main.c 项目: eagle2com/projet
int main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;
  
  //multiply the base quartz frequency (32768) by 100
  SCFQCTL = 100-1;
  CCTL0 = CCIE;
  TACTL = TACLR;
  TACTL = TASSEL_2 + MC_1;
  TACCR0 = 32768-1;
  
  
  int i = 0;
  // wait for xtal to stabilize
  FLL_CTL0 |= XCAP14PF;
  do
  {
    IFG1 &= ~OFIFG;
    for (i = 0x47FF; i > 0; i--);
  }
  while ((IFG1 & OFIFG));
  
  //input output configuration
  P2DIR = 0xF;
  P2OUT = 0;
  P1IES = 0;
  P1IE = 0xF;
  P1IFG = 0;
 
  //init mmodules
  em_init();
  dm_init();
  sw_reset();
  
  __enable_interrupt();	    //globaly enable interrupts
  
  _BIS_SR(LPM0_bits + GIE); //on éteint presque tout pour économiser
  
  for(;;);
}
示例#3
0
/**
 * Rutina para manejo de error tipo FSCM
 */
void FSCM_Routine(void)
{
    //rutina a ejecutar luego de este fallo
    printf("*******************************************************\r\n");
    printf("Ocurrio un error con el CLK configurado en pic_pc104\r\n");
    printf("Actualmente el PIC esta en modo FSCM, osea clk=FRC\r\n");
    printf("Se tratara de cambiar a clk=FRC w PLL\r\n");
    printf("*******************************************************\r\n");
    
    int arg=FRC_OSC_WITH_POSTSCALER_PLL;
    //ppc_newosc((void *)&arg);
    set_new_osc(arg);

    printf("***************************************************************\r\n");
    printf("Si ves esto, es porque ahora clk=FRC w PLL\r\n");
    printf("FSCM se acivo por una falla en el clk configurado en pic_pc104 (probablemente PRIM OSC w PLL)\r\n");
    printf("Ahora clk=FRC w PLL y se proceder? AHORA a Resetear el PIC\r\n");
    printf("***************************************************************\r\n");

    mPWRMGNT_GetClkFailDetectBit()=0;
    sw_reset(1);
}