Exemplo n.º 1
0
void pdb_init(uint8 PDB_TriggerInputSourceSel, ADC_Type *ADC_Adcx)
{
	pdb_init_struct.PDB_CounterPeriodUs = 10;   //PDB计数器周期设置
	pdb_init_struct.PDB_LoadModeSel = LOADMODE_0; //加载模式设置
	pdb_init_struct.PDB_DelayS = 2;    //中断延时时间2秒
	pdb_init_struct.PDB_ContinuousModeEnable = FALSE;     //禁用连续工作模式
	pdb_init_struct.PDB_TriggerInputSourceSel = PDB_TriggerInputSourceSel;     //配置触发源为PIT0
	LPLD_PDB_Init(pdb_init_struct);
	LPLD_PDB_AdcTriggerCfg(ADC_Adcx, PRETRIG_EN_A, 0);
}
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();
  
}