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 support@ccsinfo.com

why do we use *=5,*=8,*=16??

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







why do we use *=5,*=8,*=16??
PostPosted: Thu Jul 09, 2009 8:30 pm     Reply with quote

Can someone explain to me why do we use *=5,*=8,*=16 ?

Thanks
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Jul 09, 2009 9:59 pm     Reply with quote

If you search the current (03/2009) CCS PCM User Manual for *=16 you will find the answer on pages 95/96 and 316.
_________________
Google and Forum Search are some of your best tools!!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 10, 2009 12:35 pm     Reply with quote

The historical reason for having different storage sizes for the pointer
variable itself is probably because in the early days, CCS only supported
8-bit pointers. The early PICs such as 16C73a (for the PCM compiler)
did not have RAM beyond the address of 0xFF. So only 8-bit pointers
were needed.

Then Microchip added new PICs with RAM at address 0x100 and higher.
Initially, CCS probably only allowed access to this RAM area with "access
routines", such as read_bank() and write_bank(). These functions are still
in the CCS manual but are rarely used today.

Then CCS decided to allow access to all RAM by pointers. This required
increasing the amount of the memory allocated to the pointer to 16-bits.
That's because addresses in the range from 0x0100 to 0x01FF (used by
the 16F877) require 2 bytes to hold them. To allow the user to enable
the new 16-bit pointers, CCS added the #device *=16 statement.
(The default is *=8 for the PCM compiler).

It requires additional instructions, and therefore more ROM, to support
16-bit pointers in the 16F-series PICs. For this reason, CCS kept the
default at 8-bit pointers. If you want to use all of RAM, you do it with
the knowledge that it will require somewhat more ROM usage.

The 18F-series always use 16-bit pointers and don't need #device *=16.
There's no additional ROM usage for this in the 18F-series.
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