<?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: URGENT HELP with code on 1769 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519212#M3046</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by capiman on Sun Nov 03 03:54:57 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Pindonga123,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;your variable/array vect is too small.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;vect[5] has 5 entries which go from vect[0] to vect[4] and you are using vect[5] in last case of your switch (and even before, when filling the entry).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You are also not checking for overrun, if your number is bigger than your array.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:36:43 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:36:43Z</dc:date>
    <item>
      <title>URGENT HELP with code on 1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519211#M3045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pindonga123 on Sun Nov 03 03:40:07 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello. I did this code but something is wrong. I dont know where it's. I send a number of 1 to 6 digit and i wanna shows them in the 6 seven segment display. But when i send for example 2 all is ok, 24 too, 243 too, 2438 too, 24387 too. But the problem is that when i send the 6 digit sometime only show me 5 or sometime nothing. For example if i send 243879, only show me 43879 or something nothing. Here is the code. The problem is not in the display refresh, I did something probes more and it's ok, Is not in the display neither.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void mostrar_dig (unsigned long num)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned long i=0, vect[5];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while (num &amp;gt; 0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;vect&lt;/SPAN&gt;&lt;I&gt;=num%10;&lt;BR /&gt;num=num/10;&lt;BR /&gt;i++;&lt;BR /&gt;}&lt;BR /&gt;i--;&lt;BR /&gt;while (i&amp;gt;=0)&lt;BR /&gt;{&lt;BR /&gt;switch (i)&lt;BR /&gt;{&lt;BR /&gt;case 0:&lt;BR /&gt;GPIO_ClearValue (0, clear);&lt;BR /&gt;GPIO_SetValue (0, vector_b0[vect&lt;I&gt;]);&lt;BR /&gt;i--;&lt;BR /&gt;Delay (1);&lt;BR /&gt;break;&lt;BR /&gt;case 1:&lt;BR /&gt;GPIO_ClearValue (0, clear);&lt;BR /&gt;GPIO_SetValue (0, vector_b1[vect&lt;I&gt;]);&lt;BR /&gt;i--;&lt;BR /&gt;Delay (1);&lt;BR /&gt;break;&lt;BR /&gt;case 2:&lt;BR /&gt;GPIO_ClearValue (0, clear);&lt;BR /&gt;GPIO_SetValue (0, vector_b2[vect&lt;I&gt;]);&lt;BR /&gt;Delay (1);&lt;BR /&gt;i--;&lt;BR /&gt;break;&lt;BR /&gt;case 3:&lt;BR /&gt;GPIO_ClearValue (0, clear);&lt;BR /&gt;GPIO_SetValue (0, vector_b3[vect&lt;I&gt;]);&lt;BR /&gt;i--;&lt;BR /&gt;Delay (1);&lt;BR /&gt;break;&lt;BR /&gt;case 4:&lt;BR /&gt;GPIO_ClearValue (0, clear);&lt;BR /&gt;GPIO_SetValue (0, vector_b4[vect&lt;I&gt;]);&lt;BR /&gt;i--;&lt;BR /&gt;Delay (1);&lt;BR /&gt;break;&lt;BR /&gt;case 5:&lt;BR /&gt;GPIO_ClearValue (0, clear);&lt;BR /&gt;GPIO_SetValue (0, vector_b5[vect&lt;I&gt;]);&lt;BR /&gt;Delay (1);&lt;BR /&gt;i--;&lt;BR /&gt;break;&lt;BR /&gt;default:&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:36:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519211#M3045</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT HELP with code on 1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519212#M3046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by capiman on Sun Nov 03 03:54:57 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Pindonga123,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;your variable/array vect is too small.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;vect[5] has 5 entries which go from vect[0] to vect[4] and you are using vect[5] in last case of your switch (and even before, when filling the entry).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You are also not checking for overrun, if your number is bigger than your array.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:36:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519212#M3046</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT HELP with code on 1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519213#M3047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pindonga123 on Sun Nov 03 04:12:44 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I corrected the array number and now it only shows me the numer 0. Can you explain me a little more about overrun?. I mean my number is only of 1 digit because I divided it by 10, so in each positition of array enter only a number from 0 to 9. Sorry but my english is not good.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot. I corrected it and now it work ok. I changed unsigned long vect &lt;/SPAN&gt;&lt;I&gt;, only for int vect&lt;I&gt;, but i dont know exactly but did......ja ja ja. In fact i have some serious problem with size declaration. Do you Know or have some where i can read it?&lt;/I&gt;&lt;/I&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:36:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519213#M3047</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT HELP with code on 1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519214#M3048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Pacman on Mon Nov 04 02:20:26 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt; In fact i have some serious problem with size declaration&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I recommend using these:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for unsigned values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;uint8_t
uint16_t
uint32_t&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for signed values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;int8_t
int16_t
int32_t&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Because if you use 'long' or 'int' or the like, the compiler will choose a size.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Overrun is if you have an array, with for instance space for 10 bytes, and you are writing to the byte at location 11 (or higher).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use the following universal #define to get the number of elements in an array, thus you can check the size in an easy way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define ARRAY_SIZE(a)&amp;nbsp; (sizeof((a)) / sizeof((a)[0]))&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;uint8_t buf[13];

len = ARRAY_SIZE(buf)
while(i &amp;lt; len)
{
&amp;nbsp; i++;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:36:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/URGENT-HELP-with-code-on-1769/m-p/519214#M3048</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:36:44Z</dc:date>
    </item>
  </channel>
</rss>

