PSoC™ 5, 3 & 1 Forum Discussions
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
}
}
Hi everybody!!
actually i´m working to control a servo motor i read that the frecuency is 20 hz and the duty cycle is 1,1.5 and 2 ms
i´m using pwm16:
parameter pwm16
clock = 1,000,000
period= 49,999
duty cycle = 999-> 1ms->0°
1499-> 1.5ms -> 90°
1999 -> 2ms -> 180°
but the servo doesn´t work correctly don´t go to the correctly position and keeps vibrating and i don´t understand why,so if someone help me i´m really be glateful
i put my code if someone can check it
Hi everybody!!
actually i´m working to control a servo motor i read that the frecuency is 20 hz and the duty cycle is 1,1.5 and 2 ms
i´m using pwm16:
parameter pwm16
clock = 1,000,000
period= 49,999
duty cycle = 999-> 1ms->0°
1499-> 1.5ms -> 90°
1999 -> 2ms -> 180°
but the servo doesn´t work correctly don´t go to the correctly position and keeps vibrating and i don´t understand why,so if someone help me i´m really be glateful
i put my code if someone can check it
Sir,
Is it possible in PSOC to estimate the power drawn by the processor while executing code? . If yes please give me instructions how to perform.
Thanks & Regards
Prashant
Show LessWhat happens when a negative voltage drives the input pin of PSoC? Is it gonne bias the internal transistors which may lead to malfunctioning or is there a breakdown somewhere?
And also is there any method wherein I acn generate a -ve voltage using PSoC?
Show LessPlease refer to the link below for component creation training. The videos almost cover, all the aspects of component creation.
http://www.cypress.com/?id=2232&rtID=134
Show LessLooking over the application note AN58304 (www.cypress.com/) I saw that IDACs had dedicated pins, but it does not mention VDACs having dedicated pins. Looking at figure 2 it shows the VIDACs as one component, so does this mean that they share that dedicated pin? If not does this mean my best option for routing to a VDAC is to use a global?
Show LessWhen an ADC is configured in continuous mode does calling ADC_DelSig_StopConvert() mean that the ADC's filters need to be flushed again when ADC_DelSig_StartConvert() is called?
Show Less