<br><font size=2 face="sans-serif">Harald,</font>
<br>
<br><font size=2 face="sans-serif">Thankyou for your help. The routines work. They're a bit cumbersome however.</font>
<br>
<br><font size=2 face="sans-serif">What would be fantastic would be efficient routines to do the following.</font>
<br><font size=2 face="sans-serif"> u_char uchar_P( u_char *p_uchar );</font>
<br><font size=2 face="sans-serif"> u_short ushort_P( u_short *p_ushort );</font>
<br><font size=2 face="sans-serif"> u_long ulong_P( u_long *p_ulong );</font>
<br>
<br><font size=2 face="sans-serif">Then it would be possible to do something like this.</font>
<br><font size=2 face="sans-serif"> a = b + ushort_P( &c ) + d;</font>
<br><font size=2 face="sans-serif">This is a lot easier to read and understand.</font>
<br>
<br><font size=2 face="sans-serif">Regards & many thanks,<br>
Peter S<br>
<br>
Peter Scandrett<br>
Engineering Systems Department<br>
ALSTOM Australia Limited<br>
3 Bridge Street, Pymble, 2073, Australia<br>
Phone (+612) 94 88 49 11 Fax (+612) 94 88 49 00<br>
peter.scandrett@transport.alstom.com</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Harald Kipp <harald.kipp@egnite.de></b></font>
<br><font size=1 face="sans-serif">Sent by: en-nut-discussion-admin@egnite.de</font>
<p><font size=1 face="sans-serif">02-10-2002 08:28 pm</font>
<br><font size=1 face="sans-serif">Please respond to en-nut-discussion</font>
<br>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To: en-nut-discussion@egnite.de</font>
<br><font size=1 face="sans-serif"> cc: (bcc: Peter Scandrett/AUMIL01/Transport/ALSTOM)</font>
<br><font size=1 face="sans-serif"> Subject: Re: [En-Nut-Discussion] Reading Program Memory Arrays</font></table>
<br>
<br>
<br><font size=2><tt>Sorry, Peter. The answer comes a bit late.<br>
</tt></font>
<br><font size=2><tt>There are different solutions:<br>
</tt></font>
<br><font size=2><tt>u_short val;<br>
</tt></font>
<br><font size=2><tt>/* Solution 1 */<br>
memcpy_P(&val, &ccitt_16_table[i], sizeof(u_short));<br>
</tt></font>
<br><font size=2><tt>/* Solution 2 */<br>
val = PRG_RDB(&ccitt_16_table[i]) + PRG_RDB(((u_char *)&ccitt_16_table[i])<br>
+ 1) << 8;<br>
</tt></font>
<br><font size=2><tt>In any case you need to transfer the progmem u_short to<br>
a SRAM u_short first.<br>
</tt></font>
<br><font size=2><tt>Harald<br>
</tt></font>
<br><font size=2><tt>_______________________________________________<br>
En-Nut-Discussion mailing list<br>
En-Nut-Discussion@egnite.de<br>
http://www.egnite.de/mailman/listinfo/en-nut-discussion</tt></font>
<br>
<br>