Max.Otto11
Newbie level 6
- Joined
- Oct 13, 2014
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 180
Hi all,
i am working with PsoC 5LP. I want to display 16-bit ADC value on LCD in Volts format. ADC input range is 0.0 to Vref so the LCD will start from (0,1, 0,2, 0,3...1.024V). Or may be in another understandable format i tried but i don't understand the converted value.
pls find the code which i tried.
i am working with PsoC 5LP. I want to display 16-bit ADC value on LCD in Volts format. ADC input range is 0.0 to Vref so the LCD will start from (0,1, 0,2, 0,3...1.024V). Or may be in another understandable format i tried but i don't understand the converted value.
pls find the code which i tried.
Code:
int main()
{
uint16 ADC_Ans;
//uint8 ADC_Ans8;
Sys_Init(); // System Initializing
CY_SET_REG8(CYREG_MLOGIC_DEBUG, CY_GET_REG8(CYREG_MLOGIC_DEBUG) | 0x40);
ADC_DelSig_Start();
ADC_DelSig_StartConvert();
/* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
while(1)
{
LCD_ClearDisplay() ;
LCD_PrintString("ADC Value:");
CyDelay(1500); // Delay in ms
ADC_DelSig_IsEndConversion(ADC_DelSig_WAIT_FOR_RESULT);
ADC_Ans = ADC_DelSig_GetResult16();
//ADC_DelSig_StopConvert();
//ADC_Ans8 = ADC_Ans >> 8;
LCD_Position(0,10);
LCD_PrintString("0x");
LCD_Position(0,12);
LCD_PrintHexUint8(ADC_Ans);
//LCD_PrintInt8(ADC_Ans);
CyDelay(1500); // Delay in ms
/* Place your application code here. */
}
}