This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using LF2407 EVM

Hi,

 

Is there a ready example in C for using the ADC's on the LF240 EVM module.

 

Thanks

  • Hi ngt

     

    Here is some of my old code:

      // initialization (I don't know who starts the conversion, but I assume it is PWM module)
      ADCTRL1 = 0x0F90;
      ADCTRL2 = 0x4140;
      MAXCONV  = 0x0005;  // sest kanalov
      CHSELSEQ1 = 0x2013; // katere kanale hocmo
      CHSELSEQ2 = 0x0064;

     

    Code in PWM interrupt (triggered by Timer 1)

      // wait for ADC to finish
      while ( (ADCTRL2 & 0x1000) == 0x1000)
      {
        asm(" NOP");
      }
      // reset sequencer
      ADCTRL2 = ADCTRL2 | 0x4000;
      // calcualte tok
      temp = (RESULT0 >> 1) & 0x7FFF;
      tok = (int)(((long)temp * (long)KI) >> 15);

    I hope this helps

    Regards, Mitja