|
|
View previous topic :: View next topic |
Author |
Message |
tommynguyen Guest
|
why do we use *=5,*=8,*=16?? |
Posted: Thu Jul 09, 2009 8:30 pm |
|
|
Can someone explain to me why do we use *=5,*=8,*=16 ?
Thanks |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Thu Jul 09, 2009 9:59 pm |
|
|
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
|
|
Posted: Fri Jul 10, 2009 12:35 pm |
|
|
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. |
|
|
|
|
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
|