You are here

Complete project walk-thru, making a simple voltmeter with PSoC Creator with a PSoC3 or PSoC5 | Cypress Semiconductor

Complete project walk-thru, making a simple voltmeter with PSoC Creator with a PSoC3 or PSoC5

I know I said we wanted to keep these videos between 1 and 5 minutes, but this first video takes the first time or novice PSoC Creator user through a simple project from start to finish.  The project is a simple voltmeter that measures a voltage between 0 and 1 volt and displays the result on a 2 by 16 character display with a floating point value. Although this project uses a PSoC3, it is equally compatible with PSoC 5. The video is about 15 minutes, but I recommend it for new users.  If you don’t want to watch the entire video just fast forward to the parts of interest.  You can download a copy of the project described in this video here.

Mark Hastings

 

The entire code for this project is shown below.

/* ========================================
 * MyFirstvoltMeter
 *
 * Simple project to read a voltage between
 * 0 and 1 volts and display it on an LCD.
 *
 * ========================================
*/
#include
#include

void main()
{
    int32 adcResult;
    float adcVolts;
    char  tmpStr[25];
   
    ADC_Start();  /* Initialize components */
    LCD_Start();
   
    LCD_Position(0,0);    /* Display message */
    LCD_PrintString("PSoC VoltMeter");
   
    ADC_StartConvert();   /* Start ADC conversions */

    for(;;)  /* Loop forever */
    {
       if(ADC_IsEndConversion(ADC_RETURN_STATUS) != 0)  /* Check for result */
       {
          adcResult = ADC_GetResult32() ;               /* Get Reading     */
          adcVolts = ADC_CountsTo_Volts( adcResult) ;   /* Convert to volts */
          sprintf(tmpStr,"%+1.3f volts", adcVolts);     /* Create a formatted string */
          
          LCD_Position(1,0);                            /* Display on LCD */
          LCD_PrintString(tmpStr);
       }
    }
}

ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.