- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am having a problem writing a floating point value to the UART. I read about an issue at the link below, and my problem likely is related somehow .
http://www.cypress.com/?app=forum&id=2492&rID=86619
The problem is that the UART terminal does not respond at all when attempting to write floating point data to it. This happens even if you set the compiler to not use the nano libraries.
I know my UART setup is working because integers and ASCII strings print flawlessly.
Thanks for any suggestions or workarounds.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Info is a bit short, what is the definition of MyVar? Better post your complete project.
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
this should work
odissey1
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#if defined (__GNUC__)
/* Add an explicit reference to the floating point printf library */
/* to allow the usage of floating point conversion specifiers. */
/* This is not linked in by default with the newlib-nano library. */
asm (".global _printf_float");
#endif
char strMsg1[64];//output UART buffer
...
sprintf(strMsg1, "%f", 0.01);
UART_1_PutString(strMsg1);
- 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
I tried the above sugessions. The UART is still not printing the data. What is going on? It worked just fine prior to release 3.0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kind of a wild guess: try to increase the head size for your project. There were reports that the 128 bytes its now set to by default might be too small.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See also http://www.cypress.com/?app=forum&id=2492&rID=70447&start=21 (right at the bottom) - the heap size seems to be the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I adjusted the heap size and that fixed my original problem. I now am having a new problem. The UART arbitrallarly simply just stops writing floating point data to the UART.
I was thinking the interrupt was the cause, but I took it out of the loop. Same problem.
Is there a memory leak or something going on?
My updated project is attached.