|
Thanks Dana for identifying a basic mistake. My errors are shown in the attached file.
In another example I connected a k type thermocouple to P0_4 and P0_5 and trying to display temerature on the LCD.
My following code works but conversions are incorrect. Why microvolt to temperature routine is giving me in correct results?
void main(void)
{
/* Variable to hold ADC count */
int32 voltCount = 0;
int32 microVolts;
int32 temp1;
/* Character array to hold the micro volts*/
char displayStr[15] = {'\0'};
CYGlobalIntEnable;
/* Start ADC and start conversion */
ADC_Start();
ADC_StartConvert();
/* Start LCD and set position */
LCD_Start();
LCD_Position(0,1);
LCD_PrintString("ADC Data");
while(1)
{
/* Read ADC count and convert to milli volts */
ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
voltCount = ADC_GetResult32();
microVolts = ADC_CountsTo_uVolts(voltCount);
temp1=Thermocouple_GetTemperature(microVolts);
sprintf(displayStr," %ld ",temp1);
LCD_Position(1,0);
LCD_PrintString(displayStr);
CyDelay(500);
}
}
|