kangwuwei 发表于 2014-8-11 10:30

28335ADC配置

28335的AD如何配置呀 我从例程ADC的程序把通道ADCIN0 改成到了ADCIN1后 没有转化数据出现,如何做
InitAdc();         // For this example, init the ADC

// Specific ADC setup for this example:
   AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK;// Sequential mode: Sample rate   = 1/[(2+ACQ_PS)*ADC clock in ns]
                        //                     = 1/(3*40ns) =8.3MHz (for 150 MHz SYSCLKOUT)
                                          //                     = 1/(3*80ns) =4.17MHz (for 100 MHz SYSCLKOUT)
                                          // If Simultaneous mode enabled: Sample rate = 1/[(3+ACQ_PS)*ADC clock in ns]
   AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS;
   AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;      // 1Cascaded mode
   AdcRegs.ADCTRL1.bit.CONT_RUN = 1;       // Setup continuous run
   //AdcRegs.ADCTRL1.bit.ADCBSYCHN =
   AdcRegs.ADCTRL1.bit.SEQ_OVRD = 1;       // Enable Sequencer override feature
   AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x01;
   AdcRegs.ADCCHSELSEQ2.all = 0x0;
   AdcRegs.ADCCHSELSEQ3.all = 0x0;
   AdcRegs.ADCCHSELSEQ4.all = 0x0;
   AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0x1;
   AdcRegs.ADCTRL2.all = 0x2000;

   scic_fifo_init();           // Initialize the SCI FIFO
          scic_echoback_init();// Initalize SCI for echoback

          msg = "\r\n\n\nHello World!\0";
          scic_msg(msg);

          msg = "\r\nIf you change the ADC Res,we will give you the value! \n\0";
          scic_msg(msg);
// Enable global Interrupts and higher priority real-time debug events:
    //EINT;   // Enable Global interrupt INTM
   // ERTM;   // Enable Global realtime interrupt DBGM
        i = 0;
    for(; ;)
    {
            // LED_pulse();
            PM2_5_reg = ~0x40;
            DELAY_US(260);

            while(AdcRegs.ADCST.bit.INT_SEQ1 == 0);
            AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
       ADCValue = ( (AdcRegs.ADCRESULT0) >>4);
       PMvalue = ADCValue;

   // PMvalue = ((double)PMvalue /4096) *3*3/2;
   //PMvalue = (PMvalue-0.0356)*120000 * 0.127 -0.0999;
       sprintf(cbuf,"tne PM2.5 is %d\n",ADCValue);

            DELAY_US(20);
            PM2_5_reg = 0x40;
            DELAY_US(9680);
            DELAY_US(200000);
            scic_msg(cbuf);

wangch_sh 发表于 2014-8-11 16:32

ADCValue = ( (AdcRegs.ADCRESULT0) >>4);
这还是ADC0啊!

zhangmangui 发表于 2014-8-11 22:57

楼上说的有道理

kangwuwei 发表于 2014-8-14 09:58

AdcRegs.ADCRESULT1也不行

zhangmangui 发表于 2014-8-14 23:26

参考一下分享的资料吧   
里面看看有没有ADC的代码供你参考排查一下寄存器的配置
DSP28335资料分享
页: [1]
查看完整版本: 28335ADC配置