At 03:05 PM 7/20/01 -0500, Lawrence Lile wrote: >This works: > > DO{ > hours++; > pString = &Array[0]; // you can write pString = Array; > printf( MakeString,"Time is: %2U", hours); > home_lcd(); > puts(array); > delay_ms(1000); > }WHILE(TRUE); It works if Array is of static duration (i.e. global or declared as static). That's because such variables are initialized to 0 at startup. If Array is an automatic variable (eg. declared inside main() without the "static" storage class qualifier) then it won't _necessarily_ work (but it might). The problem here is that "MakeString" doesn't actually make a string, it leaves out the terminating null. 8-( You should put this in explicitly (same as below). In the above case, if you start out with Array all zeros, it will over-write the non-zero part over and over, and you'll be left with the original zero(s) to terminate it. >But this don't > > DO{ // do { > hours++; > pString = &Array[0]; // pString = Array; is the same thing > printf( MakeString,"Time is: %2U", hours); Looks like "MakeString" is not adding the terminating \0 at the end try: printf( MakeString,"Time is: %2u\0", hours); // u not U > strcpy(string1, " horay!"); // trying to use STRCPY.. STRCAT to construct a string > strcat(array, string1); // Causes the Dreaded Memory Problem after a couple rounds > home_lcd(); > puts(array); > delay_ms(1000); > }WHILE(TRUE); // while(1) A very common way to do the infinite loop is: for(;;) { // my program lives here } Note: ANSI C is case-sensitive, so it should be "while" not "WHILE" etc. It may see like I am being picky but it will save you a lot of time if you ever want to port your code to another processor. Otherwise none of your key words will be recognized. You could do #define WHILE while #define DO do etc. but why? BTW, traditionally, all-upper-case is reserved for preprocessor macros such as constants that have been #defined, but there is nothing in the language that enforces this. Best regards, =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com Contributions invited->The AVR-gcc FAQ is at: http://www.bluecollarlinux.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu