user3483: I have a problem understanding the following code:
PROGMEM  prog_uint16_t x={1232,3232,43343};
rawlen = pgm_read_word_near(x);
memcpy_P(uSendBuff, pfSendBuff+1, rawlen * sizeof(uint16_t));

Why do we need this? -
rawlen * sizeof(uint16_t));

Why not this? -
memcpy_P(uSendBuff, pfSendBuff+1, sizeof(rawlen));


user630: Probably because x is an array of integers (although in the code you posted you miss the '[]'), thus memcpy_p should run over rawlen integers, each integer occupies sizeof(uint16_t) bytes, hence rawlen * sizeof(uint16_t) bytes in program memory space.

3483: <p>I have a problem understanding the following code:</p>



<pre class="lang-cpp prettyprint-override"><code>PROGMEM  prog_uint16_t x={1232,3232,43343};
rawlen = pgm_read_word_near(x);
memcpy_P(uSendBuff, pfSendBuff+1, rawlen * sizeof(uint16_t));
</code></pre>

<p>Why do we need this? -</p>

<pre class="lang-cpp prettyprint-override"><code>rawlen * sizeof(uint16_t));
</code></pre>

<p>Why not this? -</p>

<pre class="lang-cpp prettyprint-override"><code>memcpy_P(uSendBuff, pfSendBuff+1, sizeof(rawlen));
</code></pre>
 630: <p>Probably because x is an <strong>array</strong> of integers (although in the code you posted you miss the '[]'), thus memcpy_p should run over <code>rawlen</code> integers, each integer occupies <code>sizeof(uint16_t)</code> bytes, hence <code>rawlen * sizeof(uint16_t)</code> bytes in program memory space.</p>
