- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone!
I am creating a script to read a voltage from an analog pin and show the value by UART. I am using this code:
----------------------------------
#include <project.h>
#include <stdio.h>
int main()
{
int32 temp;
int16 ADCResultado;
float32 ADCVoltaje;
char str[30];
UART_Start();
UART_UartPutChar(12);
UART_UartPutString("Conversor AD:");
UART_UartPutCRLF(0u);
ADC_Start();
for(;;)
{
ADC_EnableInjection();
ADC_StartConvert();
ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
ADCResultado=ADC_GetResult16(1);
ADCVoltaje=ADC_CountsTo_Volts(0,ADCResultado);
sprintf(str,"Voltaje: %.4f V",ADCVoltaje);
UART_UartPutString(str);
UART_UartPutCRLF(0u);
CyDelay(500);
}
}
-----------------------------------
The problem is I obtain this in UART: "Voltaje: V" and there are 5V in pin 2.0 (which I attached correctly). Can you help me?
Many thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you take a loot at my old memo?
printf and float rhapsody (aka, yet another printf and floating topic)
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you take a loot at my old memo?
printf and float rhapsody (aka, yet another printf and floating topic)
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response.
My problem was an incorrect Heap Syze that you comment in the second case in your explanation.
Thank you very much.
Best regards.