Professional Documents
Culture Documents
Size Examples
Data Type Specifier Signed/Unsigned Range
(bits)
short short pire;
short int 1 Unsigned 0 to 1 short int pire;
int1 pire;
int1
unsigned unsigned zat;
unsigned int unsigned int zat;
8 Unsigned 0 to 255 int zat;
int
char zat;
char
int8 zat;
int8
long long tatil;
long int 16 Unsigned 0 to 65535 long int tatil;
int16 tatil;
int16
signed signed hava;
signed int 8 Signed -128 to 127 signed int hava;
signed int8 hava;
signed int8
signed long Signed signed long yol;
16 -32768 to 32767
signed int16 signed int16 yol;
int32 32 Unsigned 0 to 4294967296 int32 deniz;
signed int32 32 Signed -2147483648 to 2147483648 singned int32 gol;
float 32 Signed ±1.175494351x10-38 to ±3.402823466x1038 float okyanus;
Furthermore, to aid program development and to improve readability of source codes, the following
definitions are given in devices.h files:
#define FALSE 0 // FALSE is defined to be equal to zero
#define TRUE 1 // TRUE is defined to be equal to one
#define BYTE int // BYTE is defined to be equal to variable-type int
#define BOOLEAN short int // BOOLEAN is defined to be equal to variable-type short
int
Hence with the above definitions, the following variable declerations may be utilized:
BYTE zat; // zat is a variable of type BYTE which is in fact an 8-bit size int type
BOOLEAN pire; // pire is a variable of type BOOLEAN which is in fact a 1-bit size short int
Atılım University
Department of Mechatronics Engineering
MECE 308
Keyword CONST can be used before a variable name (identifier) to treat it as a constant.
Constants must be initialized and may not be changed at run-time. Pointers to constants are not
permitted. The compiler has support for placing any data structure into the device ROM (Program
Memory) as a constant read-only element. For example, to place a 10 element BYTE array in RAM
or ROM use:
byte table[10]= {9,8,7,6,5,4,3,2,1,0}; // table is an array of 10 byte elements placed in RAM
byte const table[10]= {9,8,7,6,5,4,3,2,1,0}; // table is an array of 10 byte elements placed in ROM
Numeric, character and string (array of characters) type constants with various formats are
summarized in the following table. In the examples of this table sayi, harf and kelime are variables
that are equated to various constants.
CCS Pic-C provides several arithmetic and logical operators that include the following:
Operator Examples a=0x03 a=0b00000011
b=0x11 b=0b00010001
- Negation -0b00000011
Unary
-a -0x03 0b11111101
~ One's complement ~a 0xFC 0b11111100
Atılım University
Department of Mechatronics Engineering
MECE 308
Furthermore, there are operators such as +=, -=, *=, /=, %=, &=, |=, ^=, >>=, <<= that are called
compound operators.