CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Alais naming method.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Alais naming method.
PostPosted: Fri Feb 14, 2003 9:28 am     Reply with quote

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.
PostPosted: Fri Feb 14, 2003 10:23 am     Reply with quote

Do you want to locate a byte directly or do you want to create an alias Smile ? 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.
PostPosted: Fri Feb 14, 2003 2:21 pm     Reply with quote

:=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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group