You are on page 1of 15

C51- Data types Data type bit example: bit my_flag; my_flag=1; sbit example: sbit switch=P1^3; switch=0;

sfr example: 8 sfr P1=0x90; sfr P2=0xA0; unsigned char my_data; my_data=P1; sfr16 example: sfr16 T2=0xCC; T2=0xAE01; signed char unsigned char example: unsigned long temp; temp=250000; signed short un signed short signed int unsigned int signed long 16 16 16 16 32 -32768 to +32767 0 to 65535 -32768 to +32767 0 to 65535 8 8 -128 to +127 0 to +255 16 0 to 65535 0 to 255 1 0 or 1 bits 1 range 0 or 1

unsigned long float example float t1,t2; t1=26.4; t2=sqrt(t1);

32 32

Structure of a Microcontroller based C program # include <AT892051.h> #define .. sbit. int.. char. void func() { .. } main() { . }

You might also like