CY8CKIT-147 PSoC® 4100PS Prototyping Kit

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
shge_4395051
Level 4
Level 4
25 sign-ins 25 replies posted First solution authored

Hello

The device datasheet of the  CY8CKIT-147 PSoC 4100PS Prototyping Kit states that the operating range of the ADC is 0 to 5.5V.  I'm trying to configure the ADC as a single ended with 5V reference.  I cannot seem to do this.  Does this peripheral have this ability?  If not, can you refer me to a product line with a dev kit that can handle a 0 to 5V ADC input range? 

thanks

Shawn

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried it this morning.

I created a project with following schematic and connected a pot externally.

001-schematic.JPG

ADC Configuration

004-ADC_Config.JPG

The pot's vdd is connected to the VDD of CY8CKIT-147 and vss is connected to the GND of CY8CKIT-147.

IMG_3996.JPG

IMG_3997.JPG

Then I changed the position of the POT from min to max

and read the value from ADC.

===================

Tester Display

5.014   2047

4.975   2047

4.012   1649

3.001   1241

2.074   868

1.032   437

0.506   213

0.000   0

===================

So it seems that we can measure from 0V to 5V, although the configuration of ADC states 3.3V.

Then I modified my main.c as below

===================

#include "project.h"

#include "stdio.h"

#define VDDA    5.0

#define ADC_MAX 0x7FF

char str[128] ; /* print buffer */

void print(char *str)

{

    UART_UartPutString(str) ;

}

void init_hardware(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    ADC_Start() ;

}

void splash(void)

{

    print("ADC Test CY8CKIT-147 ") ;

    sprintf(str, "(%s %s)\n", __DATE__, __TIME__) ;

    print(str) ;

}

int16_t measure(void)

{

    int16_t value ;

    ADC_StartConvert() ;

    ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) ;

    value = ADC_GetResult16(0) ;

    return(value) ;

}

int main(void)

{

    int16_t ivalue = 0 ;

 

    init_hardware() ;

    splash() ;

    for(;;)

    {

        ivalue = measure() ;

        sprintf(str, "%d: %d.%03dV\n",

            ivalue,

            (int)(VDDA * ivalue / ADC_MAX),

            (int)(1000 * VDDA * ivalue / ADC_MAX) % 1000

        ) ;

        print(str) ;

     

        CyDelay(1000) ;

    }

}

/* [] END OF FILE */

===================

The UART output to TeraTerm was

003-TeraTerm.JPG

moto

View solution in original post

0 Likes
4 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hello Shawn,

Could you please let us know what exactly is the observation at your end ? Is the device malfunctioning ? Or are you getting wrong results ?

Best Regards,
Vasanth

0 Likes

Hi Vasanth

I just want to know how to configure the ADC to read input voltages from 0V to 5V.

Best regards,

Shawn

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried it this morning.

I created a project with following schematic and connected a pot externally.

001-schematic.JPG

ADC Configuration

004-ADC_Config.JPG

The pot's vdd is connected to the VDD of CY8CKIT-147 and vss is connected to the GND of CY8CKIT-147.

IMG_3996.JPG

IMG_3997.JPG

Then I changed the position of the POT from min to max

and read the value from ADC.

===================

Tester Display

5.014   2047

4.975   2047

4.012   1649

3.001   1241

2.074   868

1.032   437

0.506   213

0.000   0

===================

So it seems that we can measure from 0V to 5V, although the configuration of ADC states 3.3V.

Then I modified my main.c as below

===================

#include "project.h"

#include "stdio.h"

#define VDDA    5.0

#define ADC_MAX 0x7FF

char str[128] ; /* print buffer */

void print(char *str)

{

    UART_UartPutString(str) ;

}

void init_hardware(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    ADC_Start() ;

}

void splash(void)

{

    print("ADC Test CY8CKIT-147 ") ;

    sprintf(str, "(%s %s)\n", __DATE__, __TIME__) ;

    print(str) ;

}

int16_t measure(void)

{

    int16_t value ;

    ADC_StartConvert() ;

    ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) ;

    value = ADC_GetResult16(0) ;

    return(value) ;

}

int main(void)

{

    int16_t ivalue = 0 ;

 

    init_hardware() ;

    splash() ;

    for(;;)

    {

        ivalue = measure() ;

        sprintf(str, "%d: %d.%03dV\n",

            ivalue,

            (int)(VDDA * ivalue / ADC_MAX),

            (int)(1000 * VDDA * ivalue / ADC_MAX) % 1000

        ) ;

        print(str) ;

     

        CyDelay(1000) ;

    }

}

/* [] END OF FILE */

===================

The UART output to TeraTerm was

003-TeraTerm.JPG

moto

0 Likes

Thank you. This answered my question.

Shawn Gerber