Problem whit PSOC1 ADCINC and LM35

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

cross mob
Anonymous
Not applicable

 Hi, I'm starting to program in PSOC and I have problem with the ADCINC, I made a program for read a LM35, but when i conected it, to psoc it only read cero, if a remplace with a pot i can see the variation, i have been searching a explain but i cant found it. I hope that you can help me. I anex the code. excuse me for me redaction y and the coments in spanish.

   

 

   

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

   

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

   

#include "stdlib.h"     //incluimos la libreria para conversiones

   

#include "delay.h"      //incluimos la libreria para retardos

   

#include "string.h"     //incluimos libreria para punto flotante

   

#define _FTOA_TOO_LARGE -2

   

#define _FTOA_TOO_SMALL -1

   

 

   

/*El programa realizará una conversion analogica a digital para detectar temperatura mediante un sensor LM35

   

y visualizarlo posteriormente mediante un LCD con barra grafica. 

   

 

   

ADCINC:                                 PGA:

   

DataFormat: UnSigned.                  Gain:  1.00

   

Resolucion: 10bits.                  Input: AnalogComun_InputMUX_0

   

Data Clock: VC1(2MHz).               Reference: VSS

   

ClockPhase: Normal.                  AnalogBug: Disable

   

PosInput:   ACB00

   

NegInput:   --

   

NegInputGain:  Disconected.

   

 

   

REFERENCIAS:

   

http://www.cypress.com/?rID=58118

   

http://www.cypress.com/?id=4&rID=47960

   

http://psocenespanol.blogspot.mx/

   

http://www.cypress.com/?id=4&rID=60580

   

Hoja de datas del ADCINC

   

Hoja de datos del PGA

   

Hoja de datos lenguaje C

   

*/

   

 

   

//----------------------------------------------------------------------

   

//                           CONDICIONES GLOBALES

   

//----------------------------------------------------------------------

   

 

   

char*flotante;          //puntero para el punto flotante

   

int valor;              //entero para almacenar valores

   

float temperatura;          //flotante para generar voltaje

   

int estado;             //estado de comparacion para el flotante

   

//----------------------------------------------------------------------

   

//                           Codigo de Programacion

   

//----------------------------------------------------------------------

   

 

   

void main(void)

   

{

   

M8C_EnableGInt ;   //Abilitamos interrupciones globales.

   

LCD_Start();           //inicializamos la LCD

   

PGA_Start(3);           //iniciamos el PGA e indicamos que opera con potencia alta (3=PGA_HIGHPOWER)

   

ADCINC_Start(3);       //iniciamos el ADCINC e indicamos que opera con potencia alta (3=ADCINC_HIGHPOWER)

   

ADCINC_GetSamples(0);       //indicamos que el ADC registra muestras continuas. 

   

LCD_InitBG(LCD_SOLID_BG);   //inicializamos la barra grafica con lineas

   

   

while(1){               //iniciamos el bucle infinito

   

LCD_Position(0,0);           //posicionamos el lcd para escritura

   

LCD_PrCString("Temperatura:");   //escribimos la etiqueta voltaje

   

   

while(ADCINC_fIsDataAvailable()!=0){        //mientras la lectura sea valida

   

valor=ADCINC_wGetData();                //valor adquirirá el valor de lectura

   

ADCINC_fClearFlag();                    //reseteamos la bandera del ADC incremental

   

temperatura= (float)valor*100/1023;           //convertimos los bits a flotantes

   

LCD_Position(0,9);                     //posicionamos el LCD

   

flotante=ftoa(temperatura,&estado);         //conversion para impresion en LCD

   

LCD_PrString(flotante);                 //imprimimos el voltaje

   

LCD_DrawBG(1,0,25,temperatura*.8);

   

}

   

Delay10msTimes(20);     //creamos un retardo

   

LCD_Control(1);         //resetamos la lcd

   

}

   

}

   
        
0 Likes
3 Replies
Anonymous
Not applicable

If you are getting proper readings using a POT then the problem is related to LM35 or its connection to PSoC 1. Did you check voltage at the ADC pin when operating with LM35?

   

-Rajiv Badiger 

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Hooked up correctly for the package ? Note which view pinout is

   

described, top or bottom specified.

   

 

   

Attached hookup and pinout.

   

 

   

Regards, Dana.

0 Likes
AbhishekK_31
Employee
Employee
10 sign-ins First comment on KBA 10 solutions authored

Check the voltage at the output of LM35. Also can you attach the project so that various parameter settings could be checked 

0 Likes