Strings usage

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I want to do my firts experiments with AVR32 in my EVK1100.
I would like to read some values from an ADC and printing them to the display.
My problem is: how to manage strings? What are (and where are) the libraries to include for it? For example I want to convert an integer to a string...what functions can I use?
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have access to newlib, check the docco here: http://sources.redhat.com/newlib/

-S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks! I've downloaded the suggested library, but there is only atoi (ascii to int)... i need a kind of itoa (int to string)...
Any suggestions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

squidgit wrote:
You have access to newlib, check the docco here: http://sources.redhat.com/newlib/

-S.

How can I integrate these libraries into my sistem? Have I to copy them to a specific location?
Aren't there any integrated library for operating with strings in the cygwin libraries? I've found strig.h inside cygwin directories, but I can find only prototypes and not declaration of funcitions...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

iodz83 wrote:
Thanks! I've downloaded the suggested library, but there is only atoi (ascii to int)... i need a kind of itoa (int to string)...
Any suggestions?

Hello, you can use sprintf() function.

int a=34;
char NumString[10];
dip204_set_cursor_position(0,4);
sprintf(NumString, "%d", a);
dip204_write_string(NumString);

This example should print "34" on the LCD DISPLAY.

Regards, Matej

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I've not solved my problem. I can't integrate those libraries in my workspace. What is the correct procedure? It seems that I have to precompile them...right? How can I do that?
Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It seems like that these libraries are already integrated...right? I've tried to a program similar compile this:

#include 
#include  
#include "board.h"
#include "compiler.h"
#include "gpio.h"
#include "usart.h"

int main(void)
{
...... //initialization of USART
usart_putchar(DBG_USART,'a');
printf("Hello");
}

When I run the program I correctly receive the character 'a' but not the string "Hello". the point is: how I redirect printf output to my serial port?
Thanks!