I would like to know some variables size for two mcus. I guess that it is tied to the architecture so it be different from pic16 to pic 18.
Could someone give :
For a PIC16F876A
------------------------
char *Var = ???
char Var = ???
short Var = ???
int Var = ???
long Var = ???
For a PIC18F6720
------------------------
char *Var = ???
char Var = ???
short Var = ???
int Var = ???
long Var = ???
I want these infos cause I have some weird compiler errors that doesn't allow me to do some stuff as ( on a pic16f876a ) :
char *Var = 0x100
the error telling me 0x110 isnt between [0..255].
This is kinda confusing, I cannot believe a pointer on a byte could be only 0 to 255, haha...
Mebbie it may be related to the #locate which is associated with
Thank you very much
Warm regards
Arnaud
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Wed Mar 16, 2005 4:12 pm
For a PIC16F876A
------------------------
char *Var = 8 bits, but it can be 16 bits if you add: #use device *=16
char Var = unsigned 8 bits
short Var = 1 bit
int Var = unsigned 8 bits
long Var = unsigned 16 bits
Example of how to enable 16-bit pointers for the PCM compiler:
Code:
#include <16F876A.H>
#device *=16 // Put this statement on the next line after the #include.
main()
{
while(1);
}
For a PIC18F6720
------------------------
char *Var = 16 bits
char Var = unsigned 8 bits
short Var = 1 bit
int Var = unsigned 8 bits
long Var = unsigned 16 bits
It may be easier if you use CCS's alternate data types. Then you
can instantly see the size:
int1
int8
int16
int32
These are all unsigned.
amaye
Joined: 16 Mar 2005 Posts: 2
Posted: Thu Mar 17, 2005 2:29 am
Ok, this new directive is working properly as expected
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