cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

 Hello...

   

            I am new to this cyppress controllers,I have just started to  working on CY7C6435648LTXC                           controller.I was doing ADC LCD coding.

   

            Here my problem is I am getting the ADC output,that again i am converting to voltage and                           displayiingbon LCD.That output voltage if i  am measureing with the multimeter that is not                           matching with the output voltage of  ADC.

   

            I am using external voltage divider circuit (potentiometer).

   

Can any one help me to sort out this.

   

And this is my code.

   

-=======================================================================================

   

#include <m8c.h>        // part specific constants and macros

   

#include "PSoCAPI.h"    // PSoC API definitions for all User Modules

   

#include "stdlib.h"

   

 

   

void main(void)

   

{

   

int val = 0, flag = 0;

   

float Scaling_factor,voltage;

   

//int Result;

   

char *Result;

   

int status;

   

   

  LCD_Start(); //Initializing LCD

   

flag   = (PRT0DR & 0x01);

   

   

MUX_CR1 = flag; //Connecting Output of ADC to P0.0

   

   

 

   

    ADCINC_Start(ADCINC_INPUT_ANALOG_BUS);//Start conversion

   

   

LCD_Position(0,0);

   

LCD_PrCString("ADC_OUTPUT = ");

   

       LCD_PrHexInt(flag);

   

LCD_Position(1,0);

   

LCD_PrCString("ADC_Vin=");

   

while(1)

   

{

   

   //val = ADCINC_GetSample(); //get the ADC value

   

   

  //while(ADCINC_fIsDataAvailable())

   

  {

   

val = ADCINC_GetSample();

   

LCD_Position(0,12);

   

LCD_PrHexInt(val);

   

   

voltage= (val /(float)1023);

   

voltage *= (3.3);

   

   

//voltage = (val * Scaling_factor); 

   

Result = ftoa(voltage , &status);

   

LCD_Position(1,8);

   

LCD_PrString(Result);

   

//LCD_PrCString("v");

   

}

   

   

   

}

   

}

   
        
0 Likes
Reply
5 Replies
ETRO_SSN583
Esteemed Contributor

Use "file", "archive project", and post that. Use IE or Firefox to

   

post the file.

   

 

   

There are too many other questions that this will help answer by forum

   

members.

   

 

   

Regards, Dana.

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

By the way, on start page of Designer there is an example

   

project you can look at that does essentially what you are

   

trying to do.

   

 

   

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

The pic I tried to show you, attached.

0 Likes
Reply
Anonymous
Not applicable

 Thank you very much.....

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

Are you up and running, problem solved ?

   

 

   

Regards, Dana.

0 Likes
Reply