<html>
  <head>
    <meta content="text/html; charset=ISO-8859-2"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="Helvetica, Arial, sans-serif">Ja bych to udelal takto:<br>
      {<br>
        uint16_t tmp_counter = 2048;<br>
        while (1) {<br>
          // ...<br>
        }<br>
      }<br>
      <br>
      Hynek Sladky<br>
      <br>
      <br>
    </font>
    <div class="moz-cite-prefix">Dne 13.2.2015 12:54, Michal Lukac
      napsal(a):<br>
    </div>
    <blockquote cite="mid:F8230CF32C6A4488A3E34D2244C6019C@cimml2"
      type="cite">
      <div dir="ltr">
        <div style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR:
          #000000">
          <div>Zdravim, mam takuto cast kodu:</div>
          <div>Tu premennu tmp_counter som chcel definovat vnutri toho
            bloku s tim ze bude platna len v tom bloku a </div>
          <div>na zaciatku sa inicializuje, kvoli setreniu miesta v
            pamati. Lenze to nefunguje prelozi sa to viz. nizsie, ako
            keby sa ta hodnota nemenila cize to vsetko potom kompilator
            ignoruje</div>
          <div>Ked tu definiciu dam pred to while tak to funguje. chcel
            som len aby zbytocne nezaberala miesto. Dalo by sa to aj s
            cyklom for v tomto pripade, ale ma zaujima ked by tam malo
            byt while</div>
          <div>Da sa to nejak inak urobit? </div>
          <div> </div>
          <div>dik.</div>
          <div>michal</div>
          <div> </div>
          <div>uint32_t tmp32 = 0;</div>
          <div>uint16_t tmp16;</div>
          <div> </div>
          <div>while(1){</div>
          <div>        uint16_t tmp_counter = 2048;</div>
          <div>        if (bit_is_clear(ADCSRA,ADSC)) {</div>
          <div>            tmp16 = ADCL;    </div>
          <div>            tmp16 |= ((uint16_t)ADCH << 8);</div>
          <div>            tmp32 += tmp16;</div>
          <div>            tmp_counter--;</div>
          <div>            AD_START;</div>
          <div>            if (tmp_counter == 0) {</div>
          <div>                tmp32 >>= 5;</div>
          <div>                offset_I = tmp32;</div>
          <div>                </div>
          <div>                utoa((unsigned int)tmp32,s_out,10);</div>
          <div>                lcd_gotoxy(0,0);</div>
          <div>                lcd_puts(s_out);</div>
          <div>                _delay_ms(3000);</div>
          <div>                lcd_clrscr();</div>
          <div>                break;            </div>
          <div>            }</div>
          <div>        }</div>
        </div>
      </div>
    </blockquote>
  </body>
</html>