<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem using sprintf with LCD in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problem-using-sprintf-with-LCD/m-p/162817#M5329</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is very basic C programming. You need "string" to be an ARRAY to define some storage for sprintf to write to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;char vString[100];
char *pText;
int nVar = 123

sprintf(vString, "The value: %d", nVar);
pText = vString; /* this is the same as "pText = &amp;amp;vString[0];" */
while (*pText)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; ... And so on, the same as before ...
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if you can get an old K&amp;amp;R C book and work through that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:08:54 GMT</pubDate>
    <dc:creator>TomE</dc:creator>
    <dc:date>2020-10-29T09:08:54Z</dc:date>
    <item>
      <title>Problem using sprintf with LCD</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problem-using-sprintf-with-LCD/m-p/162816#M5328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to print the value of a int variable to one LCD but it's not working properly, I've tried many things but I would like to know how can I include a int variable to a normal a string that I want to print to the LCD.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can only print normal texts to the LCD but without variables, for example doing this:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;char *text="Hello world"; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (*text) &lt;/P&gt;&lt;P&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; senddatatoLCD (*text++);&amp;nbsp; //Function made to send data to LCD in 2 lines using 4 bits only.&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to build a string with value of int variable already included and then just send this string with a while loop as I've on the example shown before.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this: sprintf (*string, "The value: %d", var);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the use the *string to print it to the LCD.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone knows how to do it?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 11:55:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problem-using-sprintf-with-LCD/m-p/162816#M5328</guid>
      <dc:creator>johnt</dc:creator>
      <dc:date>2012-11-02T11:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using sprintf with LCD</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problem-using-sprintf-with-LCD/m-p/162817#M5329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is very basic C programming. You need "string" to be an ARRAY to define some storage for sprintf to write to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;char vString[100];
char *pText;
int nVar = 123

sprintf(vString, "The value: %d", nVar);
pText = vString; /* this is the same as "pText = &amp;amp;vString[0];" */
while (*pText)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; ... And so on, the same as before ...
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if you can get an old K&amp;amp;R C book and work through that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:08:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problem-using-sprintf-with-LCD/m-p/162817#M5329</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2020-10-29T09:08:54Z</dc:date>
    </item>
  </channel>
</rss>

