View previous topic :: View next topic |
Author |
Message |
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Alais naming method. |
Posted: Fri Feb 14, 2003 9:28 am |
|
|
How do I locate a byte indirectly? I know their has to be some simple way to make this work.
int8 PacketBuffer[24],slave;
#locate slave = *PacketBuffer[0]
This does not work.
I want to make an alais name for the first array location of of an array.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11685 |
|
|
Tomi Guest
|
Re: Alais naming method. |
Posted: Fri Feb 14, 2003 10:23 am |
|
|
Do you want to locate a byte directly or do you want to create an alias ? Making alias in C means a #define directive:
#define slave PacketBuffer[0]
Example:
PacketBuffer 000000C9 // from list file
0000 00542 .................... slave = 0x10;
0078 3010 00543 MOVLW 10
0079 1683 00544 BSF 03.5
007A 00C9 00545 MOVWF 49 // 0x80+0x49=0xC9 !
:=How do I locate a byte indirectly? I know their has to be some simple way to make this work.
:=
:=int8 PacketBuffer[24],slave;
:=#locate slave = *PacketBuffer[0]
:=
:=This does not work.
:=I want to make an alais name for the first array location of of an array.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11688 |
|
|
R.J.Hamlett Guest
|
Re: Alais naming method. |
Posted: Fri Feb 14, 2003 2:21 pm |
|
|
:=How do I locate a byte indirectly? I know their has to be some simple way to make this work.
:=
:=int8 PacketBuffer[24],slave;
:=#locate slave = *PacketBuffer[0]
:=
:=This does not work.
:=I want to make an alais name for the first array location of of an array.
Don't bother to try to force a declaration like this (they only accept constants, and your syntax would be wrong anyway - you require the address, not the contents of a pointer). Instead just use the macro language. So:
#define slave (PacketBuffer[0])
Will give a 'psuedonym' for the first entry, and the compiler (since it uses a constant address), will replace this with a direct access, with no array overhead.
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 11699 |
|
|
|