Jump to content
Sign in to follow this  
gviaud

16F628 and const char pointers

Recommended Posts

Yes,I had.

Using the LCD_Lprintf function:

 

void LCD_Lprintf( const char *lcdptr )

{

 char pi;

 pi = 0;                                        // Check for end of string

   while( lcdptr[pi] !=  0)

        {

           LCD_Write_4_Bit( lcdptr[pi++] );// Display on LCD

        }

}

 

with something like:

LPrintf("Test");

LPrintf("Test again");

 

System reatarts or behaves weird after printing the first string correctly.

I tried saving the strings in the EEPROM, pointing to the fisrt char and using putchar() in a loop instead and it worked.

 

regards

Share this post


Link to post
Share on other sites

If you look output window in the simulator while this occurs, you can see that the stack overflows/underflows. I didn't see any other workaround than to replace the const char * with normal char * :(

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×