[En-Nut-Discussion] Reading Program Memory Arrays

peter.scandrett at transport.alstom.com peter.scandrett at transport.alstom.com
Thu Oct 3 02:26:08 CEST 2002


Harald,

Thankyou for your help. The routines work. They're a bit cumbersome 
however.

What would be fantastic would be efficient routines to do the following.
        u_char      uchar_P(  u_char  *p_uchar  );
        u_short     ushort_P( u_short *p_ushort );
        u_long      ulong_P(  u_long  *p_ulong  );

Then it would be possible to do something like this.
        a = b + ushort_P( &c ) + d;
This is a lot easier to read and understand.

Regards & many thanks,
Peter S

Peter Scandrett
Engineering Systems Department
ALSTOM Australia Limited
3 Bridge Street, Pymble, 2073, Australia
Phone (+612) 94 88 49 11      Fax (+612) 94 88 49 00
peter.scandrett at transport.alstom.com




Harald Kipp <harald.kipp at egnite.de>
Sent by: en-nut-discussion-admin at egnite.de
02-10-2002 08:28 pm
Please respond to en-nut-discussion

 
        To:     en-nut-discussion at egnite.de
        cc:     (bcc: Peter Scandrett/AUMIL01/Transport/ALSTOM)
        Subject:        Re: [En-Nut-Discussion] Reading Program Memory Arrays


Sorry, Peter. The answer comes a bit late.

There are different solutions:

u_short val;

/* Solution 1 */
memcpy_P(&val, &ccitt_16_table[i], sizeof(u_short));

/* Solution 2 */
val = PRG_RDB(&ccitt_16_table[i]) + PRG_RDB(((u_char *)&ccitt_16_table[i])
+ 1) << 8;

In any case you need to transfer the progmem u_short to
a SRAM u_short first.

Harald

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo/en-nut-discussion

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20021003/b2d1d605/attachment-0001.html>


More information about the En-Nut-Discussion mailing list