如题,在controlSUITE\development_kits\HVPSFB_v1.1\HVPSFB_PCMC 中ADC_SOC_CNF()函数最后对AdcRegs.ADCSOCFRC1.all置位,该置位会导致adc转换一直进行吗?该寄存器的置位是否能自动清零?我在adc的参考指南中并没有看到更详细的说明,希望能得到官方的解释,谢谢?
代码及寄存器说明如下:
void ADC_SOC_CNF(int ChSel[], int Trigsel[], int ACQPS[], int IntChSel, int mode)
{
extern void DSP28x_usDelay(Uint32 Count);
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
DSP28x_usDelay(1000); // Delay before converting ADC channels
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1;//脉冲产生在写结果之后何德威2016.12.5
AdcRegs.ADCSOC0CTL.bit.ACQPS = ACQPS[0];
AdcRegs.ADCSOC1CTL.bit.ACQPS = ACQPS[1];
AdcRegs.ADCSOC2CTL.bit.ACQPS = ACQPS[2];
AdcRegs.ADCSOC3CTL.bit.ACQPS = ACQPS[3];
AdcRegs.ADCSOC4CTL.bit.ACQPS = ACQPS[4];
AdcRegs.ADCSOC5CTL.bit.ACQPS = ACQPS[5];
AdcRegs.ADCSOC6CTL.bit.ACQPS = ACQPS[6];
AdcRegs.ADCSOC7CTL.bit.ACQPS = ACQPS[7];
AdcRegs.ADCSOC8CTL.bit.ACQPS = ACQPS[8];
AdcRegs.ADCSOC9CTL.bit.ACQPS = ACQPS[9];
AdcRegs.ADCSOC10CTL.bit.ACQPS = ACQPS[10];
AdcRegs.ADCSOC11CTL.bit.ACQPS = ACQPS[11];
AdcRegs.ADCSOC12CTL.bit.ACQPS = ACQPS[12];
AdcRegs.ADCSOC13CTL.bit.ACQPS = ACQPS[13];
AdcRegs.ADCSOC14CTL.bit.ACQPS = ACQPS[14];
AdcRegs.ADCSOC15CTL.bit.ACQPS = ACQPS[15];
AdcRegs.INTSEL1N2.bit.INT1SEL = IntChSel; // IntChSel causes ADCInterrupt 1
if (mode == 0) // Start-Stop conv mode
{
AdcRegs.ADCINTFLG.bit.ADCINT1 = 0; // clear interrupt flag for ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // clear ADCINT1 flag to begin a new set of conversions
AdcRegs.ADCINTSOCSEL1.all=0x0000; // No ADCInterrupt will trigger SOCx
AdcRegs.ADCINTSOCSEL2.all=0x0000;
}
if (mode == 1) // Continuous conv mode
{
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; // set ADCInterrupt 1 to auto clr
AdcRegs.ADCINTSOCSEL1.all=0xFF;// ADCInterrupt 1 will trigger SOCx, TrigSel is ignored
AdcRegs.ADCINTSOCSEL2.all=0xFF;
}
if (mode == 2) // CLA mode, Start Stop ADC with auto clr ADC Flag
{
AdcRegs.ADCINTFLG.bit.ADCINT1 = 0; // clear interrupt flag for ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; // set ADCInterrupt 1 to auto clr
AdcRegs.ADCINTSOCSEL1.all=0x0000; // No ADCInterrupt will trigger SOCx
AdcRegs.ADCINTSOCSEL2.all=0x0000;
}
if(IntChSel<15)
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enable ADC interrupt 1
else
AdcRegs.INTSEL1N2.bit.INT1E = 0; // disable the ADC interrupt 1
// Select the channel to be converted when SOCx is received
AdcRegs.ADCSOC0CTL.bit.CHSEL= ChSel[0];
AdcRegs.ADCSOC1CTL.bit.CHSEL= ChSel[1];
AdcRegs.ADCSOC2CTL.bit.CHSEL= ChSel[2];
AdcRegs.ADCSOC3CTL.bit.CHSEL= ChSel[3];
AdcRegs.ADCSOC4CTL.bit.CHSEL= ChSel[4];
AdcRegs.ADCSOC5CTL.bit.CHSEL= ChSel[5];
AdcRegs.ADCSOC6CTL.bit.CHSEL= ChSel[6];
AdcRegs.ADCSOC7CTL.bit.CHSEL= ChSel[7];
AdcRegs.ADCSOC8CTL.bit.CHSEL= ChSel[8];
AdcRegs.ADCSOC9CTL.bit.CHSEL= ChSel[9];
AdcRegs.ADCSOC10CTL.bit.CHSEL= ChSel[10];
AdcRegs.ADCSOC11CTL.bit.CHSEL= ChSel[11];
AdcRegs.ADCSOC12CTL.bit.CHSEL= ChSel[12];
AdcRegs.ADCSOC13CTL.bit.CHSEL= ChSel[13];
AdcRegs.ADCSOC14CTL.bit.CHSEL= ChSel[14];
AdcRegs.ADCSOC15CTL.bit.CHSEL= ChSel[15];
AdcRegs.ADCSOC0CTL.bit.TRIGSEL= Trigsel[0];
AdcRegs.ADCSOC1CTL.bit.TRIGSEL= Trigsel[1];
AdcRegs.ADCSOC2CTL.bit.TRIGSEL= Trigsel[2];
AdcRegs.ADCSOC3CTL.bit.TRIGSEL= Trigsel[3];
AdcRegs.ADCSOC4CTL.bit.TRIGSEL= Trigsel[4];
AdcRegs.ADCSOC5CTL.bit.TRIGSEL= Trigsel[5];
AdcRegs.ADCSOC6CTL.bit.TRIGSEL= Trigsel[6];
AdcRegs.ADCSOC7CTL.bit.TRIGSEL= Trigsel[7];
AdcRegs.ADCSOC8CTL.bit.TRIGSEL= Trigsel[8];
AdcRegs.ADCSOC9CTL.bit.TRIGSEL= Trigsel[9];
AdcRegs.ADCSOC10CTL.bit.TRIGSEL= Trigsel[10];
AdcRegs.ADCSOC11CTL.bit.TRIGSEL= Trigsel[11];
AdcRegs.ADCSOC12CTL.bit.TRIGSEL= Trigsel[12];
AdcRegs.ADCSOC13CTL.bit.TRIGSEL= Trigsel[13];
AdcRegs.ADCSOC14CTL.bit.TRIGSEL= Trigsel[14];
AdcRegs.ADCSOC15CTL.bit.TRIGSEL= Trigsel[15];
EDIS;
AdcRegs.ADCSOCFRC1.all = 0xFFFF; // kick-start ADC
}
Eric Ma:
这个位是软件产生一次强制ADC转换。
Eric
如题,在controlSUITE\development_kits\HVPSFB_v1.1\HVPSFB_PCMC 中ADC_SOC_CNF()函数最后对AdcRegs.ADCSOCFRC1.all置位,该置位会导致adc转换一直进行吗?该寄存器的置位是否能自动清零?我在adc的参考指南中并没有看到更详细的说明,希望能得到官方的解释,谢谢?
代码及寄存器说明如下:
void ADC_SOC_CNF(int ChSel[], int Trigsel[], int ACQPS[], int IntChSel, int mode)
{
extern void DSP28x_usDelay(Uint32 Count);
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
DSP28x_usDelay(1000); // Delay before converting ADC channels
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1;//脉冲产生在写结果之后何德威2016.12.5
AdcRegs.ADCSOC0CTL.bit.ACQPS = ACQPS[0];
AdcRegs.ADCSOC1CTL.bit.ACQPS = ACQPS[1];
AdcRegs.ADCSOC2CTL.bit.ACQPS = ACQPS[2];
AdcRegs.ADCSOC3CTL.bit.ACQPS = ACQPS[3];
AdcRegs.ADCSOC4CTL.bit.ACQPS = ACQPS[4];
AdcRegs.ADCSOC5CTL.bit.ACQPS = ACQPS[5];
AdcRegs.ADCSOC6CTL.bit.ACQPS = ACQPS[6];
AdcRegs.ADCSOC7CTL.bit.ACQPS = ACQPS[7];
AdcRegs.ADCSOC8CTL.bit.ACQPS = ACQPS[8];
AdcRegs.ADCSOC9CTL.bit.ACQPS = ACQPS[9];
AdcRegs.ADCSOC10CTL.bit.ACQPS = ACQPS[10];
AdcRegs.ADCSOC11CTL.bit.ACQPS = ACQPS[11];
AdcRegs.ADCSOC12CTL.bit.ACQPS = ACQPS[12];
AdcRegs.ADCSOC13CTL.bit.ACQPS = ACQPS[13];
AdcRegs.ADCSOC14CTL.bit.ACQPS = ACQPS[14];
AdcRegs.ADCSOC15CTL.bit.ACQPS = ACQPS[15];
AdcRegs.INTSEL1N2.bit.INT1SEL = IntChSel; // IntChSel causes ADCInterrupt 1
if (mode == 0) // Start-Stop conv mode
{
AdcRegs.ADCINTFLG.bit.ADCINT1 = 0; // clear interrupt flag for ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // clear ADCINT1 flag to begin a new set of conversions
AdcRegs.ADCINTSOCSEL1.all=0x0000; // No ADCInterrupt will trigger SOCx
AdcRegs.ADCINTSOCSEL2.all=0x0000;
}
if (mode == 1) // Continuous conv mode
{
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; // set ADCInterrupt 1 to auto clr
AdcRegs.ADCINTSOCSEL1.all=0xFF;// ADCInterrupt 1 will trigger SOCx, TrigSel is ignored
AdcRegs.ADCINTSOCSEL2.all=0xFF;
}
if (mode == 2) // CLA mode, Start Stop ADC with auto clr ADC Flag
{
AdcRegs.ADCINTFLG.bit.ADCINT1 = 0; // clear interrupt flag for ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; // set ADCInterrupt 1 to auto clr
AdcRegs.ADCINTSOCSEL1.all=0x0000; // No ADCInterrupt will trigger SOCx
AdcRegs.ADCINTSOCSEL2.all=0x0000;
}
if(IntChSel<15)
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enable ADC interrupt 1
else
AdcRegs.INTSEL1N2.bit.INT1E = 0; // disable the ADC interrupt 1
// Select the channel to be converted when SOCx is received
AdcRegs.ADCSOC0CTL.bit.CHSEL= ChSel[0];
AdcRegs.ADCSOC1CTL.bit.CHSEL= ChSel[1];
AdcRegs.ADCSOC2CTL.bit.CHSEL= ChSel[2];
AdcRegs.ADCSOC3CTL.bit.CHSEL= ChSel[3];
AdcRegs.ADCSOC4CTL.bit.CHSEL= ChSel[4];
AdcRegs.ADCSOC5CTL.bit.CHSEL= ChSel[5];
AdcRegs.ADCSOC6CTL.bit.CHSEL= ChSel[6];
AdcRegs.ADCSOC7CTL.bit.CHSEL= ChSel[7];
AdcRegs.ADCSOC8CTL.bit.CHSEL= ChSel[8];
AdcRegs.ADCSOC9CTL.bit.CHSEL= ChSel[9];
AdcRegs.ADCSOC10CTL.bit.CHSEL= ChSel[10];
AdcRegs.ADCSOC11CTL.bit.CHSEL= ChSel[11];
AdcRegs.ADCSOC12CTL.bit.CHSEL= ChSel[12];
AdcRegs.ADCSOC13CTL.bit.CHSEL= ChSel[13];
AdcRegs.ADCSOC14CTL.bit.CHSEL= ChSel[14];
AdcRegs.ADCSOC15CTL.bit.CHSEL= ChSel[15];
AdcRegs.ADCSOC0CTL.bit.TRIGSEL= Trigsel[0];
AdcRegs.ADCSOC1CTL.bit.TRIGSEL= Trigsel[1];
AdcRegs.ADCSOC2CTL.bit.TRIGSEL= Trigsel[2];
AdcRegs.ADCSOC3CTL.bit.TRIGSEL= Trigsel[3];
AdcRegs.ADCSOC4CTL.bit.TRIGSEL= Trigsel[4];
AdcRegs.ADCSOC5CTL.bit.TRIGSEL= Trigsel[5];
AdcRegs.ADCSOC6CTL.bit.TRIGSEL= Trigsel[6];
AdcRegs.ADCSOC7CTL.bit.TRIGSEL= Trigsel[7];
AdcRegs.ADCSOC8CTL.bit.TRIGSEL= Trigsel[8];
AdcRegs.ADCSOC9CTL.bit.TRIGSEL= Trigsel[9];
AdcRegs.ADCSOC10CTL.bit.TRIGSEL= Trigsel[10];
AdcRegs.ADCSOC11CTL.bit.TRIGSEL= Trigsel[11];
AdcRegs.ADCSOC12CTL.bit.TRIGSEL= Trigsel[12];
AdcRegs.ADCSOC13CTL.bit.TRIGSEL= Trigsel[13];
AdcRegs.ADCSOC14CTL.bit.TRIGSEL= Trigsel[14];
AdcRegs.ADCSOC15CTL.bit.TRIGSEL= Trigsel[15];
EDIS;
AdcRegs.ADCSOCFRC1.all = 0xFFFF; // kick-start ADC
}
dewei he:
回复 Eric Ma:
也就是对这个寄存器软件写1只能执行一次adc转换就停下来是吧,那么执行一次转换后,该寄存器的值是否会变为0呢,我手头现在没有板子没办法做实验
如题,在controlSUITE\development_kits\HVPSFB_v1.1\HVPSFB_PCMC 中ADC_SOC_CNF()函数最后对AdcRegs.ADCSOCFRC1.all置位,该置位会导致adc转换一直进行吗?该寄存器的置位是否能自动清零?我在adc的参考指南中并没有看到更详细的说明,希望能得到官方的解释,谢谢?
代码及寄存器说明如下:
void ADC_SOC_CNF(int ChSel[], int Trigsel[], int ACQPS[], int IntChSel, int mode)
{
extern void DSP28x_usDelay(Uint32 Count);
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
DSP28x_usDelay(1000); // Delay before converting ADC channels
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1;//脉冲产生在写结果之后何德威2016.12.5
AdcRegs.ADCSOC0CTL.bit.ACQPS = ACQPS[0];
AdcRegs.ADCSOC1CTL.bit.ACQPS = ACQPS[1];
AdcRegs.ADCSOC2CTL.bit.ACQPS = ACQPS[2];
AdcRegs.ADCSOC3CTL.bit.ACQPS = ACQPS[3];
AdcRegs.ADCSOC4CTL.bit.ACQPS = ACQPS[4];
AdcRegs.ADCSOC5CTL.bit.ACQPS = ACQPS[5];
AdcRegs.ADCSOC6CTL.bit.ACQPS = ACQPS[6];
AdcRegs.ADCSOC7CTL.bit.ACQPS = ACQPS[7];
AdcRegs.ADCSOC8CTL.bit.ACQPS = ACQPS[8];
AdcRegs.ADCSOC9CTL.bit.ACQPS = ACQPS[9];
AdcRegs.ADCSOC10CTL.bit.ACQPS = ACQPS[10];
AdcRegs.ADCSOC11CTL.bit.ACQPS = ACQPS[11];
AdcRegs.ADCSOC12CTL.bit.ACQPS = ACQPS[12];
AdcRegs.ADCSOC13CTL.bit.ACQPS = ACQPS[13];
AdcRegs.ADCSOC14CTL.bit.ACQPS = ACQPS[14];
AdcRegs.ADCSOC15CTL.bit.ACQPS = ACQPS[15];
AdcRegs.INTSEL1N2.bit.INT1SEL = IntChSel; // IntChSel causes ADCInterrupt 1
if (mode == 0) // Start-Stop conv mode
{
AdcRegs.ADCINTFLG.bit.ADCINT1 = 0; // clear interrupt flag for ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // clear ADCINT1 flag to begin a new set of conversions
AdcRegs.ADCINTSOCSEL1.all=0x0000; // No ADCInterrupt will trigger SOCx
AdcRegs.ADCINTSOCSEL2.all=0x0000;
}
if (mode == 1) // Continuous conv mode
{
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; // set ADCInterrupt 1 to auto clr
AdcRegs.ADCINTSOCSEL1.all=0xFF;// ADCInterrupt 1 will trigger SOCx, TrigSel is ignored
AdcRegs.ADCINTSOCSEL2.all=0xFF;
}
if (mode == 2) // CLA mode, Start Stop ADC with auto clr ADC Flag
{
AdcRegs.ADCINTFLG.bit.ADCINT1 = 0; // clear interrupt flag for ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; // set ADCInterrupt 1 to auto clr
AdcRegs.ADCINTSOCSEL1.all=0x0000; // No ADCInterrupt will trigger SOCx
AdcRegs.ADCINTSOCSEL2.all=0x0000;
}
if(IntChSel<15)
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enable ADC interrupt 1
else
AdcRegs.INTSEL1N2.bit.INT1E = 0; // disable the ADC interrupt 1
// Select the channel to be converted when SOCx is received
AdcRegs.ADCSOC0CTL.bit.CHSEL= ChSel[0];
AdcRegs.ADCSOC1CTL.bit.CHSEL= ChSel[1];
AdcRegs.ADCSOC2CTL.bit.CHSEL= ChSel[2];
AdcRegs.ADCSOC3CTL.bit.CHSEL= ChSel[3];
AdcRegs.ADCSOC4CTL.bit.CHSEL= ChSel[4];
AdcRegs.ADCSOC5CTL.bit.CHSEL= ChSel[5];
AdcRegs.ADCSOC6CTL.bit.CHSEL= ChSel[6];
AdcRegs.ADCSOC7CTL.bit.CHSEL= ChSel[7];
AdcRegs.ADCSOC8CTL.bit.CHSEL= ChSel[8];
AdcRegs.ADCSOC9CTL.bit.CHSEL= ChSel[9];
AdcRegs.ADCSOC10CTL.bit.CHSEL= ChSel[10];
AdcRegs.ADCSOC11CTL.bit.CHSEL= ChSel[11];
AdcRegs.ADCSOC12CTL.bit.CHSEL= ChSel[12];
AdcRegs.ADCSOC13CTL.bit.CHSEL= ChSel[13];
AdcRegs.ADCSOC14CTL.bit.CHSEL= ChSel[14];
AdcRegs.ADCSOC15CTL.bit.CHSEL= ChSel[15];
AdcRegs.ADCSOC0CTL.bit.TRIGSEL= Trigsel[0];
AdcRegs.ADCSOC1CTL.bit.TRIGSEL= Trigsel[1];
AdcRegs.ADCSOC2CTL.bit.TRIGSEL= Trigsel[2];
AdcRegs.ADCSOC3CTL.bit.TRIGSEL= Trigsel[3];
AdcRegs.ADCSOC4CTL.bit.TRIGSEL= Trigsel[4];
AdcRegs.ADCSOC5CTL.bit.TRIGSEL= Trigsel[5];
AdcRegs.ADCSOC6CTL.bit.TRIGSEL= Trigsel[6];
AdcRegs.ADCSOC7CTL.bit.TRIGSEL= Trigsel[7];
AdcRegs.ADCSOC8CTL.bit.TRIGSEL= Trigsel[8];
AdcRegs.ADCSOC9CTL.bit.TRIGSEL= Trigsel[9];
AdcRegs.ADCSOC10CTL.bit.TRIGSEL= Trigsel[10];
AdcRegs.ADCSOC11CTL.bit.TRIGSEL= Trigsel[11];
AdcRegs.ADCSOC12CTL.bit.TRIGSEL= Trigsel[12];
AdcRegs.ADCSOC13CTL.bit.TRIGSEL= Trigsel[13];
AdcRegs.ADCSOC14CTL.bit.TRIGSEL= Trigsel[14];
AdcRegs.ADCSOC15CTL.bit.TRIGSEL= Trigsel[15];
EDIS;
AdcRegs.ADCSOCFRC1.all = 0xFFFF; // kick-start ADC
}
Eric Ma:
回复 dewei he:
会清零。
ERIC