<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>unsigned long to digits for LCD display</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/15657/unsigned-long-to-digits-for-lcd-display</link><description> Hi,First of all, Merry Christmas! I got a problem with the little function below: I just try to display an unsigned long variable on a 6 digits LCD (I know, I m not going to be able to display the whole number)Everything works fine from 0 to 69999 but</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: unsigned long to digits for LCD display</title><link>https://community.arm.com/thread/54896?ContentTypeID=1</link><pubDate>Tue, 24 Dec 2002 01:47:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c33b11e3-6f4d-4b54-9cbb-533500f5e723</guid><dc:creator>Arnaud Stoumont</dc:creator><description>&lt;p&gt;Wow wow wow wow!&lt;br /&gt;
Thank you very much Jon!!&lt;br /&gt;
&lt;br /&gt;
Everything works fine now.&lt;br /&gt;
&lt;br /&gt;
I just wonder why my code was wrong. I guess it&amp;#39;s just not the right way to do this.&lt;br /&gt;
If somebody got some time to tell me why, I would be really happy!&lt;br /&gt;
&lt;br /&gt;
Anyway, I wish you a merry Christmas! Mine is going to be better due to you! Thanks again!&lt;br /&gt;
&lt;br /&gt;
Arnaud Stoumont&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unsigned long to digits for LCD display</title><link>https://community.arm.com/thread/39557?ContentTypeID=1</link><pubDate>Mon, 23 Dec 2002 10:51:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fe356bf9-6da1-49bf-9ca6-aade057031e4</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;The following code works just fine:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
#define LCD_LEN 8
unsigned char tab[LCD_LEN];

void compt_to_digit_4b (
  unsigned long count_4b,
  unsigned char *tab_compt)
{
unsigned char i;

for (count_4b, i=LCD_LEN; i&amp;gt;0; i--, count_4b/=10L)
  {
  tab_compt[i-1] = count_4b%10L;
  }
}

void main(void)
{
compt_to_digit_4b(70000L,tab);
compt_to_digit_4b(12345678L,tab);
compt_to_digit_4b(98765L,tab);
while (1);
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>