void F280X_ileg2_dcbus_drv_init(ILEG2DCBUSMEAS *p)
[
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL1.all = ADC_RESET_FLAG; // Reset the ADC Module
asm(" NOP ");
asm(" NOP ");
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/reference circuitry
DELAY_US(ADC_usDELAY); // Delay before powering up rest of ADC
AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL3.bit.ADCCLKPS = 16; // Set up ADCTRL3 register
AdcRegs.ADCTRL1.all = ADCTRL1_INIT_STATE; // Set up ADCTRL1 register
AdcRegs.ADCTRL2.all = ADCTRL2_INIT_STATE; // Set up ADCTRL2 register
AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 2; // Specify three conversions
AdcRegs.ADCCHSELSEQ1.all = p->ChSelect; // Configure channel selection
AdcRegs.ADCREFSEL.all = 39; // Set up the ADC reference select register
AdcRegs.ADCOFFTRIM.all = 65534; // Set up the ADC offset trim register
// Set up Event Trigger with CNT_zero enable for Time-base of EPWM1
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOCA
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // Enable CNT_zero event for SOCA
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate SOCA on the 1st event
EPwm1Regs.ETCLR.bit.SOCA = 1; // Clear SOCA flag
]
这里的ADCREG寄存器里的位寄存器和28035芯片资料上的都对应不上,如AdcRegs.ADCREFSEL.all = 39; 而芯片资料上的ADCREG就没有ADCREFSEL这个位,ADCREFSEL是属于ADCCTL1寄存器中,请您帮忙看看
void F280X_ileg2_dcbus_drv_init(ILEG2DCBUSMEAS *p)
[
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL1.all = ADC_RESET_FLAG; // Reset the ADC Module
asm(" NOP ");
asm(" NOP ");
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/reference circuitry
DELAY_US(ADC_usDELAY); // Delay before powering up rest of ADC
AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL3.bit.ADCCLKPS = 16; // Set up ADCTRL3 register
AdcRegs.ADCTRL1.all = ADCTRL1_INIT_STATE; // Set up ADCTRL1 register
AdcRegs.ADCTRL2.all = ADCTRL2_INIT_STATE; // Set up ADCTRL2 register
AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 2; // Specify three conversions
AdcRegs.ADCCHSELSEQ1.all = p->ChSelect; // Configure channel selection
AdcRegs.ADCREFSEL.all = 39; // Set up the ADC reference select register
AdcRegs.ADCOFFTRIM.all = 65534; // Set up the ADC offset trim register
// Set up Event Trigger with CNT_zero enable for Time-base of EPWM1
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOCA
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // Enable CNT_zero event for SOCA
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate SOCA on the 1st event
EPwm1Regs.ETCLR.bit.SOCA = 1; // Clear SOCA flag
]
这里的ADCREG寄存器里的位寄存器和28035芯片资料上的都对应不上,如AdcRegs.ADCREFSEL.all = 39; 而芯片资料上的ADCREG就没有ADCREFSEL这个位,ADCREFSEL是属于ADCCTL1寄存器中,请您帮忙看看
举报