3 Replies Latest reply on Mar 28, 2016 12:27 AM by sharmi91la_1561096

    ADC and UART

    sharmi91la_1561096

      I am using delta sigma adc of 18 bit resolution, I tried to convert the data into string format and print in serial. But did not get result.

         

      This is my code: 

         

      #include <project.h>
      #include <stdio.h>
      int main()
      {
          CyGlobalIntEnable; /* Enable global interrupts. */
          int16 result=0;
          float result1 = 0u;
          char8 resultStr[16u];
          char *resultstr= NULL;
          /* Place your initialization/startup code here (e.g. MyInst_Start()) */
          PWM_Start();
          ADC_Start();
          PGA_Start();
          UART_Start();
          ADC_StartConvert();   
          PWM_WritePeriod(100);
          PWM_WriteCompare(50);
          
          for(;;)
          {
               if(ADC_IsEndConversion(ADC_RETURN_STATUS))
              {
             result=ADC_GetResult32();
       
             result1=ADC_CountsTo_Volts(result);
             CyDelay(3000);
           
             sprintf((char *)resultStr,"%+1.2f",1.2663);
       
            CyDelay(1000);

          UART_PutString(resultStr);
              }
          }
              /* Place your application code here. */
          
      }