TI中文支持网
TI专业的中文技术问题搜集分享网站

关于如何设置28027 ADC中断的问题

28027有16个ADC通道对应16个触发源对应16个EOC 那为什么只提供9个中断

比如我设置SOC0-SOC11一共12个ADC转换的通道,但是止呕9个中断可以供我使用那么剩下的3个SOC该如何产生中断

EALLOW;
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power ADC BG
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; // Select interal BG
EDIS;

DELAY_US(ADC_usDELAY); // Delay before converting ADC channels
InitAdcAio();//初始化ADC IO 口
///////////////////////////
EALLOW;
///
//AdcRegs.ADCSAMPLEMODE.bit.SIMULEN0 = 0; //顺序采样默认顺序采样
//选择需要转换的通道
//过采样 高频电流
AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //VHiAc
AdcRegs.ADCSOC1CTL.bit.CHSEL = 6; //VHiAc
AdcRegs.ADCSOC2CTL.bit.CHSEL = 6; //VHiAc
AdcRegs.ADCSOC3CTL.bit.CHSEL = 6; //VHiAc
//
AdcRegs.ADCSOC4CTL.bit.CHSEL = 0; //soc通道选择 Vin
AdcRegs.ADCSOC5CTL.bit.CHSEL = 1; //ViAc
AdcRegs.ADCSOC6CTL.bit.CHSEL = 3; //TPOT
AdcRegs.ADCSOC7CTL.bit.CHSEL = 7; //TIGBT

//ADC选择采样窗口大小
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC2CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC3CTL.bit.ACQPS = 6;

AdcRegs.ADCSOC4CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC5CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC6CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC7CTL.bit.ACQPS = 6;
// soc触发选择,TIM0
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 1;
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 1;
AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 1;
AdcRegs.ADCSOC3CTL.bit.TRIGSEL = 1;
//software ctrl
AdcRegs.ADCSOC4CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC6CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC7CTL.bit.TRIGSEL = 0;
////////////////////////////////////////////////////////////////////
AdcRegs.SOCPRICTL.bit.SOCPRIORITY = 4 ;//ADC0-ADC3 high priority

AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; //结果存入寄存器才产生中断

PieVectTable.ADCINT1 = &ADC_convered1;
PieVectTable.ADCINT2 = &ADC_convered2;
PieVectTable.ADCINT3 = &ADC_convered3;
PieVectTable.ADCINT4 = &ADC_convered4;
PieVectTable.ADCINT5 = &ADC_convered4;
PieVectTable.ADCINT6 = &ADC_convered6;
PieVectTable.ADCINT7 = &ADC_convered7;
PieVectTable.ADCINT8 = &ADC_convered8;

AdcRegs.INTSEL1N2.bit.INT1SEL = 1; //中断线1选择soc1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; //不连续转换
AdcRegs.INTSEL1N2.bit.INT1E = 1; //中断使能
AdcRegs.INTSEL1N2.bit.INT2SEL = 2; //中断线1选择soc2
AdcRegs.INTSEL1N2.bit.INT2CONT = 0; //不连续转换
AdcRegs.INTSEL1N2.bit.INT2E = 1; //中断使能

AdcRegs.INTSEL3N4.bit.INT3SEL = 3; //中断线1选择soc3
AdcRegs.INTSEL3N4.bit.INT3CONT = 0; //不连续转换
AdcRegs.INTSEL3N4.bit.INT3E = 1; //中断使能
AdcRegs.INTSEL3N4.bit.INT4SEL = 4; //中断线1选择soc4
AdcRegs.INTSEL3N4.bit.INT4CONT = 0; //不连续转换
AdcRegs.INTSEL3N4.bit.INT4E = 1; //中断使能

AdcRegs.INTSEL5N6.bit.INT5SEL = 5; //中断线1选择soc5
AdcRegs.INTSEL5N6.bit.INT5CONT = 0; //不连续转换
AdcRegs.INTSEL5N6.bit.INT5E = 1; //中断使能
AdcRegs.INTSEL5N6.bit.INT6SEL = 6; //中断线1选择soc6
AdcRegs.INTSEL5N6.bit.INT6CONT = 0; //不连续转换
AdcRegs.INTSEL5N6.bit.INT6E = 1;

AdcRegs.INTSEL7N8.bit.INT7SEL = 7; //中断线1选择soc7
AdcRegs.INTSEL7N8.bit.INT7CONT = 0; //不连续转换
AdcRegs.INTSEL7N8.bit.INT7E = 1; //中断使能
AdcRegs.INTSEL7N8.bit.INT8SEL = 8; //中断线1选择soc8
AdcRegs.INTSEL7N8.bit.INT8CONT = 0; //不连续转换
AdcRegs.INTSEL7N8.bit.INT8E = 1;

PieCtrlRegs.PIEIER1.bit.INTx1 =0 ;
PieCtrlRegs.PIEIER10.all= 0xff; //使能int10
IER |= M_INT10;
EDIS;

那么剩下的3个ADC如果SOC产生了我该如何设置呢,

我的EOC10 11 12 中断送到那里去啊??????

Joey Mao:

是只有ADCINT1~9,而这些中断并不是和转换通道一一对应的,而是可以通过设置的

赞(0)
未经允许不得转载:TI中文支持网 » 关于如何设置28027 ADC中断的问题
分享到: 更多 (0)