- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
My project is to display, in different formats, the results of the A/D conversion. I cannot display the result in decimal format (floating point).
My resources are:
PSOC Creator 3.3.
PSOC4: CY8CKIT-049-42XX-(CY8C4245AX483)
LCD: RC1602B
I wrote the ”-u_printf_float” as a custom command line for the Linker tool.
The LCD is displaying only ”ADC”, at position (0,0).
Thank You!
The main file is bellow:
#include <project.h>
#include <stdio.h>
int main()
{
int32 conversie;
char cuvant [16];
float32 val,vin ;
CyGlobalIntEnable; /* Enable global interrupts. */
ADC_Start();
ADC_StartConvert();
ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
LCD_Start();
LCD_Position(0,0);
LCD_PrintString("ADC");
for(;;)
{
conversie = ADC_GetResult16(0);
val = ADC_CountsTo_Volts(0,conversie);
sprintf(cuvant,"%1.4f ",val);
LCD_Position(1,0);
LCD_PrintString(cuvant);
vin = (float32)conversie * 1024/32768;
sprintf(cuvant,"%1.3f ",vin);
LCD_Position(1,6);
LCD_PrintString(cuvant);
LCD_Position(0,6);
LCD_PrintNumber(vin);
LCD_Position(0,10);
LCD_PrintInt16(conversie);
LCD_Position(1,11);
LCD_PrintInt16(vin);
CyDelay(1000);
}
}
/* [] END OF FILE */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Can you increase the stack size inn .cydr->System_>Stack Size.
Thanks,
Hima
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not the stack size, but the heap size. Set it to at least 0x0200.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When using GCC, you also may need to set the floating point library in the linker options