- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried it this morning.
I created a project with following schematic and connected a pot externally.
ADC Configuration
The pot's vdd is connected to the VDD of CY8CKIT-147 and vss is connected to the GND of CY8CKIT-147.
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
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vasanth
I just want to know how to configure the ADC to read input voltages from 0V to 5V.
Best regards,
Shawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried it this morning.
I created a project with following schematic and connected a pot externally.
ADC Configuration
The pot's vdd is connected to the VDD of CY8CKIT-147 and vss is connected to the GND of CY8CKIT-147.
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
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. This answered my question.
Shawn Gerber