How do I get the result of the ADC printed on Putty? I am using PSoC 5LP developmental board with PSoC Creator 3.3.

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

cross mob
Anonymous
Not applicable

I am using the ADC_SingleEndedMode Example.

#define USBFS_DEVICE    (0u)

#define USBUART_BUFFER_SIZE (64u)

#define LINE_STR_LENGTH     (20u)

int main()

{

    int16 output;

   

    uint8 buffer[USBUART_BUFFER_SIZE];

   

    /* Start the components */

    CyGlobalIntEnable;

    LCD_Start();

    USBUART_Start(USBFS_DEVICE, USBUART_3V_OPERATION);

    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_GetResult16();

           

            /* Saturate ADC result to positive numbers. */

            if(output < 0)

            {

                output = 0;

            }

            USBUART_PutChar(output);

            LCD_Position(1u, 0u);

            LCD_PrintInt16(output);

        }

    }

}

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Instead of USBUART_PutChar(output); you will need a bit more as

#include <stdio.h>

uint8 Buffer[80];

sprintf(Buffer,"%d \n\r",output);

USBUART_PutString(Buffer);

Happy coding

Bob

View solution in original post

0 Likes
1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Instead of USBUART_PutChar(output); you will need a bit more as

#include <stdio.h>

uint8 Buffer[80];

sprintf(Buffer,"%d \n\r",output);

USBUART_PutString(Buffer);

Happy coding

Bob

0 Likes