Go Down

Topic: string library ? (Read 3747 times) previous topic - next topic


Well i want to make a small text generator with an arduibo board and lcd display but i discovered that there no implementation of evolved "string" instruction, like "split" or "substr" or string array in arduino langage (same thing in processing or wiring)
is there a way to add this functions in arduino or is it to heavy for the poor board memory ?
perhaps the team work on it ?

my knowledge in C are null:P

The only way i've found is to work with Flash and transmit letter by letter to arduino via serproxy... but it's not really what i wanted...
i dream of a standalone board :-/

any idea ?



Feb 21, 2006, 02:06 am Last Edit: Feb 21, 2006, 02:09 am by beltran Reason: 1
that's a good question...
I've also wondered what can be brought to Arduino from C
how to integrate libraries we find around or have available...
and that gets us to a way bigger question which is...what is the exact structure of Arduino (software)
but I will post a full thread on that.

for example this guy here http://www.e-dsp.com/how-to-use-a-lcd-with-your-electronic-devices/ has some routines for the atmega16 (not that far from the atmega8 ;) )
to easily connect an LCD... I know that the processor is different but how can we integrate that code (or a subset) into Arduino? how do you extend arduino...besides adding code directly in you project file.

anyhow, I had problems with strings as well,
I needed to be able to pass full strings back and forth from flash
you can check http://www.progetto25zero1.com/b/tools/Arduino for some code I've wrote that you might find usefull.
It passes "strings" all in one time (actually sending them char by char but it's completely invisible to you)

hope it helps


OK hold your horses :)

usually string manipulation is a bad habit inherited by languages with lots of memory to waste...  ;D  ;D  ;D

all the string functions from c are available...

The LCD code is here http://arduino.berlios.de/index.php/Tutorial/LCD8Bits

it's very simple to do a function that takes a string and loops calling LcdDataWrite() for each character (you'll end up with an equivalent of printString() for the LCD)


i'm feeling nice :)

void printStringLCD(unsigned char *s)
        while (*s)

this is like printString but sends to LCD
in arduino 4 this will be part of the standard language



yeah great!
thanks! :)
can't really understand why you are feeling nice!? ;-)

in fact I've seen that in the lib/avrlib folder there is actually an lcd.c and lcd.h and much more...there is even a servo.c library (I couldn't find the stdio.h though) but this is not used in the
tutorial and I can't really understand why we can't use these with Arduino (at least this is what I've been led to think because no one in the forum talks about this hidden goldmine ;-) )

I'm not interested in the lcd functions right now :)
thanks anyhow.  :)
what I'm really interested is in understanding the guts of Arduino software...and in particular to better understand what are the steps to implement it for another microcontroller (AVR and PIC), and many many more things...but I want to write them all at once on a new thread :)

I don't want to take the thread away from mrbpp

hear you soon



really cool your function.... :D

no no beltran, i "drink" your thread...

On the idea of beltran, i've take a look in the avrlib directory... ohoh...
there is some cute file
lcd.h lcd.c...
in lcd.c it redefine the custom caracters.. i'm french and love accents (éèêààâîôû)... can i redraw the custom caracters ?

how to use this library ?

my lcd display controller is not a ks0108 but a KS0066 (i've bougth 2 : 1X16 and 4x16)... can use the lib ?

i've tried the lcdtutorial (with arduino002) but unable to initialize correctly the lcd display... (i've spent some hours with it)
sometime (after many reset) it shows some caracters sometime nothing...
is it cause of the controller that is not the same than in the tutorial ?

And Masimo you say all the string functions from c are available...  
and  ???
which one ?
a link for tutorial for c langage usable string function. and how to use it directly in arduino ::)

I repeat my knowledge in c are..... :'( null.

Ohhhh pleaazzzzzze Massimo or beltran would you help a newbies (not newb in all langages) to point to some good help files.



Feb 21, 2006, 07:25 pm Last Edit: Feb 21, 2006, 07:33 pm by beltran Reason: 1
salut, ;)
I'm a newbie as well in Arduino...and in C...
I've started studying C thanks to arduino and going deeper now.
I've no clue yet on how to use the string library (I thought it was stdio.h but couldn't find it nor make it work)
here are a few resources for C:

- the excellent howstuffismade C article
(very good at explaning pointers)

- teach yourself C in 24 Hours online book

- teach yourself C in 21 days online book

- some more low level C for microprocessors

- as a compiler I chose MinGW http://mingw.org
which is very geeky and low level (you must compile through command line) but if you will choose it I can give you a sample .bat file to automatize the compilation. Maybe you can test DJGPP http://www.delorie.com/djgpp/ and tell me how it is ;-)...it would have been my next test, but I haven't had time yet to look over it.

I'm not sure if I made the right choice, maybe Massimo or someone else has a better platform to suggest... I even thought if it was possible to compile in C through arduino since it uses gpp as all the other free compilers...but I'm not sure of that yet...this is one of the questions I will put on the "other" thread :)

besides that...
where are you from? I lived for almost two years in Paris and I can understand that you like accents :)

hope this helps
à bientot (sorry! no accent aigu dans mon clavier ;-) )

ps. did you read the datasheet for your LCD? you might find valuable info in it.


thanks for the links...
i'll start read it when our basicstamp's workshop will be finished.

I'm on mac.... i can download and install devtools... but had to configure the gcc compiler...
i'm not sure i'm able to do that :P

I'm from north of france : near Lille.

For the lcd i've read the lcd datasheet and the timing and instruction for init are the same than in the tut...
(i've saw in the update info, that there was a bug with the milli instruction.... perhaps a starting point)
i've rapidly tested this morning the source with arduino003...
i've got a cursor but nothing on the screen.
need more time to test more seriously with new version.

and in the lcdtut, it's only for 8bits communication...
how to for the 4bits ?
(suppose init correctly the lcd in 4bits mode) and nothing more  (use the first 4 pins data...) ?


Go Up