4 Replies Latest reply on Jun 21, 2017 2:07 PM by e.pratt_1639216

    Random Symbols in Tera Term/Putty Window when Printing using UART

    mmcgovern574_2531066

      I am using ADC to monitor the voltage of an analog input value to my BLE Pioneer Kit. I want to print the voltage value every 10 milliseconds. When I click the program button while in the main.c file under source code, the program doesn't seem to start right away. Only after a few minutes does "Voltage is 0 mV" start to print in Tera Term. After printing for about 30 seconds, symbols begin to appear in the Tera Term window. I've attached a text file of the serial data that prints to Tera Term. I've made sure that the baud rates match in tera term and in the ADC settings. The code that I use in main.c is below. Any idea what the problem might be?

         

      /* ========================================
       *
       * Copyright YOUR COMPANY, THE YEAR
       * All Rights Reserved
       * UNPUBLISHED, LICENSED SOFTWARE.
       *
       * CONFIDENTIAL AND PROPRIETARY INFORMATION
       * WHICH IS THE PROPERTY OF your company.
       *
       * ========================================
      */
      #include "project.h"
      #include "stdio.h"

         

       

         

      int main()

         

      {
         ADC_Start(); //start ADC
         float x; 
         char tempStr[10];
          
         CyGlobalIntEnable; /* Enable global interrupts. */
         UART_Start(); //Starts Serial communication
          
         ADC_StartConvert(); //Starts ADC Conversion

         

      //infinite Loop begins to acquire voltage values

         

       

         

          for (;;)
          {
        
          ADC_IsEndConversion(ADC_WAIT_FOR_RESULT); //Waits for ADC value to be calculated   

         

          x=ADC_GetResult16(0); //Sets x to the value of channel 0 (analog input channel is channel 0)
          
         float y = (ADC_CountsTo_mVolts(0,x)); //converts ADC value to millivolts
         int n = y;
         
          sprintf(tempStr, " Voltage is %-d mV", n);
          
          UART_UartPutString(tempStr); //Sends string with mV value to UART
          UART_UartPutString("\r\n");
          
         CyDelay(10); //Delay before reading next value

         

          }
      }

         

      /* [] END OF FILE */