在我的应用里,我使用PWM1/2/3 来配置电机所需要的6 路 PWM,使用EPWM4 来触发三路ADCa/b/c,按理来说三个ADC a / b / c 应该是完全等价的,但奇怪的是,当我把6 路 PWM 发出来之后,跑一会,随后发生某一个ADC 工作彻底停摆了(三个中断服务程序ISR,总有那么一两个就彻底进不去了),我想知道是否我的ADC 配置是否有遗漏的 ,我的ADC 配置如下,烦请有相关经验的同学帮我诊断一下,在此拜谢了!!
void SetupADCtimer_ABC(void)
{
uint16 trigger_source = ADC_TRIG_ePWM4_SOCAC;
uint16 acqps = ADC_acqps_12BIT;
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = ADC_acqps_12BIT; // 75ns 采样保持时间
}
else
{
acqps = ADC_acqps_16BIT; // 320ns resolution is 16-bit
}
EALLOW; // Select the channels to convert and end of conversion flag
/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC3 = 1;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = ADCINA0_CurrU;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC1CTL.bit.CHSEL = ADCINA3_TempU;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC2CTL.bit.CHSEL = ADCINA4_TempV;
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC3CTL.bit.CHSEL = ADCINA5_TempW;
AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 3;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/
// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;
AdcbRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcbRegs.ADCSOC0CTL.bit.CHSEL = ADCINB3_TM_Temp0;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
/*
AdcbRegs.ADCSOC2CTL.bit.CHSEL = ADCINB0_Rev2;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCSOC3CTL.bit.CHSEL = ADCINB0_Rev1;
AdcbRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC3CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT2E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT2 = 1;
*/
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-C */
/* */
/*******************************************************************************/
AdccRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdccRegs.ADCSOC0CTL.bit.CHSEL = ADCINC2_UDC;
AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC1CTL.bit.CHSEL = ADCINC3_IW;
AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC2CTL.bit.CHSEL = ADCINC4_IDC;
AdccRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCINTSEL1N2.bit.INT1SEL = 2;
AdccRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*
AdccRegs.ADCINTSEL3N4.bit.INT3SEL = 2;
AdccRegs.ADCINTSEL3N4.bit.INT3E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT3 = 1;
*/
/*******************************************************************************/
// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag
AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdccRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
//AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
//AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared
EDIS;
}
user6049953:难道就没有哪位同学帮忙解答解答?
在我的应用里,我使用PWM1/2/3 来配置电机所需要的6 路 PWM,使用EPWM4 来触发三路ADCa/b/c,按理来说三个ADC a / b / c 应该是完全等价的,但奇怪的是,当我把6 路 PWM 发出来之后,跑一会,随后发生某一个ADC 工作彻底停摆了(三个中断服务程序ISR,总有那么一两个就彻底进不去了),我想知道是否我的ADC 配置是否有遗漏的 ,我的ADC 配置如下,烦请有相关经验的同学帮我诊断一下,在此拜谢了!!
void SetupADCtimer_ABC(void)
{
uint16 trigger_source = ADC_TRIG_ePWM4_SOCAC;
uint16 acqps = ADC_acqps_12BIT;
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = ADC_acqps_12BIT; // 75ns 采样保持时间
}
else
{
acqps = ADC_acqps_16BIT; // 320ns resolution is 16-bit
}
EALLOW; // Select the channels to convert and end of conversion flag
/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC3 = 1;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = ADCINA0_CurrU;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC1CTL.bit.CHSEL = ADCINA3_TempU;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC2CTL.bit.CHSEL = ADCINA4_TempV;
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC3CTL.bit.CHSEL = ADCINA5_TempW;
AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 3;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/
// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;
AdcbRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcbRegs.ADCSOC0CTL.bit.CHSEL = ADCINB3_TM_Temp0;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
/*
AdcbRegs.ADCSOC2CTL.bit.CHSEL = ADCINB0_Rev2;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCSOC3CTL.bit.CHSEL = ADCINB0_Rev1;
AdcbRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC3CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT2E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT2 = 1;
*/
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-C */
/* */
/*******************************************************************************/
AdccRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdccRegs.ADCSOC0CTL.bit.CHSEL = ADCINC2_UDC;
AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC1CTL.bit.CHSEL = ADCINC3_IW;
AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC2CTL.bit.CHSEL = ADCINC4_IDC;
AdccRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCINTSEL1N2.bit.INT1SEL = 2;
AdccRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*
AdccRegs.ADCINTSEL3N4.bit.INT3SEL = 2;
AdccRegs.ADCINTSEL3N4.bit.INT3E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT3 = 1;
*/
/*******************************************************************************/
// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag
AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdccRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
//AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
//AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared
EDIS;
}
Green Deng:
回复 user6049953:
你配置一个触发源同时触发3个(我看程序好像是有4个ADC?),但芯片不可能同时处理3个中断,必然会导致中断冲突
在我的应用里,我使用PWM1/2/3 来配置电机所需要的6 路 PWM,使用EPWM4 来触发三路ADCa/b/c,按理来说三个ADC a / b / c 应该是完全等价的,但奇怪的是,当我把6 路 PWM 发出来之后,跑一会,随后发生某一个ADC 工作彻底停摆了(三个中断服务程序ISR,总有那么一两个就彻底进不去了),我想知道是否我的ADC 配置是否有遗漏的 ,我的ADC 配置如下,烦请有相关经验的同学帮我诊断一下,在此拜谢了!!
void SetupADCtimer_ABC(void)
{
uint16 trigger_source = ADC_TRIG_ePWM4_SOCAC;
uint16 acqps = ADC_acqps_12BIT;
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = ADC_acqps_12BIT; // 75ns 采样保持时间
}
else
{
acqps = ADC_acqps_16BIT; // 320ns resolution is 16-bit
}
EALLOW; // Select the channels to convert and end of conversion flag
/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC3 = 1;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = ADCINA0_CurrU;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC1CTL.bit.CHSEL = ADCINA3_TempU;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC2CTL.bit.CHSEL = ADCINA4_TempV;
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC3CTL.bit.CHSEL = ADCINA5_TempW;
AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 3;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/
// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;
AdcbRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcbRegs.ADCSOC0CTL.bit.CHSEL = ADCINB3_TM_Temp0;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
/*
AdcbRegs.ADCSOC2CTL.bit.CHSEL = ADCINB0_Rev2;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCSOC3CTL.bit.CHSEL = ADCINB0_Rev1;
AdcbRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC3CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT2E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT2 = 1;
*/
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-C */
/* */
/*******************************************************************************/
AdccRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdccRegs.ADCSOC0CTL.bit.CHSEL = ADCINC2_UDC;
AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC1CTL.bit.CHSEL = ADCINC3_IW;
AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC2CTL.bit.CHSEL = ADCINC4_IDC;
AdccRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCINTSEL1N2.bit.INT1SEL = 2;
AdccRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*
AdccRegs.ADCINTSEL3N4.bit.INT3SEL = 2;
AdccRegs.ADCINTSEL3N4.bit.INT3E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT3 = 1;
*/
/*******************************************************************************/
// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag
AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdccRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
//AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
//AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared
EDIS;
}
user6049953:
回复 Green Deng:
那我这种场景应该如何处理? 我的应用是3个ADC,即a/b/c 三个,3个中断不能同时发生?
我记得ADC 好像是共用一个中断号?
在我的应用里,我使用PWM1/2/3 来配置电机所需要的6 路 PWM,使用EPWM4 来触发三路ADCa/b/c,按理来说三个ADC a / b / c 应该是完全等价的,但奇怪的是,当我把6 路 PWM 发出来之后,跑一会,随后发生某一个ADC 工作彻底停摆了(三个中断服务程序ISR,总有那么一两个就彻底进不去了),我想知道是否我的ADC 配置是否有遗漏的 ,我的ADC 配置如下,烦请有相关经验的同学帮我诊断一下,在此拜谢了!!
void SetupADCtimer_ABC(void)
{
uint16 trigger_source = ADC_TRIG_ePWM4_SOCAC;
uint16 acqps = ADC_acqps_12BIT;
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = ADC_acqps_12BIT; // 75ns 采样保持时间
}
else
{
acqps = ADC_acqps_16BIT; // 320ns resolution is 16-bit
}
EALLOW; // Select the channels to convert and end of conversion flag
/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdcaRegs.ADCSOCFRC1.bit.SOC3 = 1;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = ADCINA0_CurrU;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC1CTL.bit.CHSEL = ADCINA3_TempU;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC2CTL.bit.CHSEL = ADCINA4_TempV;
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCSOC3CTL.bit.CHSEL = ADCINA5_TempW;
AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = trigger_source;
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 3;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/
// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;
AdcbRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdcbRegs.ADCSOC0CTL.bit.CHSEL = ADCINB3_TM_Temp0;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
/*
AdcbRegs.ADCSOC2CTL.bit.CHSEL = ADCINB0_Rev2;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCSOC3CTL.bit.CHSEL = ADCINB0_Rev1;
AdcbRegs.ADCSOC3CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC3CTL.bit.TRIGSEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 1;
AdcbRegs.ADCINTSEL1N2.bit.INT2E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT2 = 1;
*/
AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*******************************************************************************/
/* */
/* ADC-C */
/* */
/*******************************************************************************/
AdccRegs.ADCSOCFRC1.bit.SOC0 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC1 = 1;
AdccRegs.ADCSOCFRC1.bit.SOC2 = 1;
AdccRegs.ADCSOC0CTL.bit.CHSEL = ADCINC2_UDC;
AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC0CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC1CTL.bit.CHSEL = ADCINC3_IW;
AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC1CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCSOC2CTL.bit.CHSEL = ADCINC4_IDC;
AdccRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdccRegs.ADCSOC2CTL.bit.TRIGSEL = trigger_source;
AdccRegs.ADCINTSEL1N2.bit.INT1SEL = 2;
AdccRegs.ADCINTSEL1N2.bit.INT1E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
/*
AdccRegs.ADCINTSEL3N4.bit.INT3SEL = 2;
AdccRegs.ADCINTSEL3N4.bit.INT3E = 1;
AdccRegs.ADCINTFLGCLR.bit.ADCINT3 = 1;
*/
/*******************************************************************************/
// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag
AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;
AdcbRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdccRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
//AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
//AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared
EDIS;
}
user6049953:
回复 Green Deng:
那是不是可以搞成一个触发源 先触发ADCA, 然后ADCA ISR 里面触发ADC B , 然后ADCB ISR 里面触发ADC C?