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.

TMS570LS31HDK——video——HERCULES12-bitADC.wmv the code that pasted in the video ?

TMS570LS31HDK'DVD——video——HERCULES12-bitADC.wmv,during the time ( 08:30 to 09:32), the video tell us how to configure the driver and CCS about ADC. But I can't distinguish the code that pasted to the main.c. Please the engineers tell me the code.Thank you.

  • Hi Bill,

    let me check with the video owner and get back to you. 

  • look forward to your reply.

  • Hi Bill,

    Here is the codes:

    Under sys_main.c

    /* USER CODE BEGIN (0) */

    #include "sci.h"

    #include "adc.h"

    #include "stdlib.h"

    unsigned char command[8];

    /* USER CODE END */

    void main(void)

    {/* USER CODE BEGIN (3) */

      adcData_t adc_data; //ADC Data Structure

      adcData_t *adc_data_ptr = &adc_data; //ADC Data Pointer

      unsigned int NumberOfChars, value; //Declare variables

      sciInit(); //Initializes the SCI (UART) module

      adcInit(); //Initializes the ADC module

      while(1)  // Loop to acquire and send ADC sample data via the SCI (UART)

      {

        adcStartConversion(adcREG1, 1U);  //Start ADC conversion

        while(!adcIsConversionComplete(adcREG1, 1U)); //Wait for ADC conversion

        adcGetData(adcREG1, 1U, adc_data_ptr); //Store conversion into ADC pointer

        value = (unsigned int)adc_data_ptr->value;

        NumberOfChars = ltoa(value,(char *)command);

        sciSend(scilinREG, 2, (unsigned char *)"0x"); //Sends '0x' hex designation chars

        sciSend(scilinREG, NumberOfChars, command); //Sends the ambient light sensor data

        sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character

      }

    /* USER CODE END */}

    hope this helps.

  • Hi Bill,

    FYI, The TI training portal will be updated in the future to include the file posting along with the video...

  • Hi ,

        Can you tell me the website and the time about where and when to download the relevant files ?

         Look forward to your reply, thank you very much.

  • Hi Bill

    unfortunately there is no website that carry this info now,

    it is part of our one day training lab exercise.  

    Let me poke around to see if we can post theses codes on wiki in short term until the portal is fully deployed.

    The portal deployment also depend on IT and i need to get back to you on exact time frame.

    but near term wiki is possible sometimes next week.

    not sure if we can post all exercises, but at least we should be able to post on wiki the one on public video.

    Let me sync up with the right folks and get back to you.