void init_PDB()
{
  pdb_init_struct.PDB_CounterPeriodMs = 1000;
  pdb_init_struct.PDB_ContinuousModeEnable = FALSE;
  pdb_init_struct.PDB_LoadModeSel = LOADMODE_0; //加载模式设置
  pdb_init_struct.PDB_TriggerInputSourceSel =  TRIGGER_PIT0;
  
  LPLD_PDB_Init(pdb_init_struct);
  LPLD_PDB_AdcTriggerCfg(ADC0, PRETRIG_EN_A, 0);
  // LPLD_PDB_AdcTriggerCfg(ADC1, PRETRIG_EN_A, 0);
  LPLD_PDB_EnableIrq();
  //LPLD_PDB_SoftwareTrigger();
  
}
Exemplo n.º 2
0
/*
 * 初始化PDB
 *
 */
void pdb_init(void)
{
  //配置PDB延时定时中断参数
  pdb_init_struct.PDB_CounterPeriodMs = 1000;   //计数器溢出周期1000毫秒
  pdb_init_struct.PDB_TriggerInputSourceSel = TRIGGER_SOFTWARE; //触发源为软件触发
  pdb_init_struct.PDB_ContinuousModeEnable = TRUE;      //连续工作模式
  pdb_init_struct.PDB_DelayMs = 200;    //中断延时时间200毫秒
  pdb_init_struct.PDB_IntEnable = TRUE; //使能延时中断
  pdb_init_struct.PDB_Isr = pdb_isr;    //中断函数设置
  //初始化PDB
  LPLD_PDB_Init(pdb_init_struct);
  //使能PDB中断
  LPLD_PDB_EnableIrq();
  //软件触发
  LPLD_PDB_SoftwareTrigger();
}