In adc lcd, potentiometer values fluctuating

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

cross mob
Anonymous
Not applicable

I am doing handson on single ended adc. For that purpose i have used the code from psoc creator code examples which is for 16 bit resolution. But i want to do adc lcd for 8 bit resolution. I have done changes in adc - resolution bit is 8 bit, input range is 1.024 v , continue mode. In main () code, i have changed data type size from 16 bit to 8 bit. I used P6[5] port for pot. When i start to vary the pot, the values are fluctuating and after FF value by varying the pot continue it starts roll over . So my question is why this is happened? Is there any settings required to do?

0 Likes
1 Solution

This function ADC_DelSig_1_GetResult8 returns the result of an 8-bit conversion. If the resolution is set greater than 8-bits, the LSB of the result will be returned. When the ADC is configured for 8-bit single ended mode, the ADC_GetResult16() function should be used instead. This function returns only signed 8-bit values. The maximum positive signed 8-bit value is 127, but in singled ended 8-bit mode, the maximum positive value is 255.

Just change ADC_DelSig_1_GetResult8 to ADC_DelSig_1_GetResult16 and it will work.

Regards,

Dheeraj

View solution in original post

0 Likes
3 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

That shouldn't happen. Its quite strange. Can you please provide your PSoC Creator project? It will make debugging easier.

Regards,

Dheeraj

0 Likes
Anonymous
Not applicable

Its similar with code example (ADC_single_ended). Only change is ADC Resolution of 8 bit.

uint8 output;

    /* Start the components */

    LCD_Start();

    ADC_DelSig_1_Start();

    /* Start the ADC conversion */

    ADC_DelSig_1_StartConvert();

    /* Display the value of ADC output on LCD */

    LCD_Position(0u, 0u);

    LCD_PrintString("ADC_Output");

    for(;;)

    {

        if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))

        {

            output = ADC_DelSig_1_GetResult8();

LCD_Position(1u, 0u);

            LCD_PrintInt8(output);

        }

    }

0 Likes

This function ADC_DelSig_1_GetResult8 returns the result of an 8-bit conversion. If the resolution is set greater than 8-bits, the LSB of the result will be returned. When the ADC is configured for 8-bit single ended mode, the ADC_GetResult16() function should be used instead. This function returns only signed 8-bit values. The maximum positive signed 8-bit value is 127, but in singled ended 8-bit mode, the maximum positive value is 255.

Just change ADC_DelSig_1_GetResult8 to ADC_DelSig_1_GetResult16 and it will work.

Regards,

Dheeraj

0 Likes