0% found this document useful (0 votes)
46 views

Basics of Embedded C Languagae

Robo India presents the fundamentals of Embedded 'C' Language. Embedded C is very useful to make autonomous robots, embedded system projects, electronics projects, physical computing projects. If you have any query please share your query and views with us. we are found at website: http://roboindia.com mail: [email protected]

Uploaded by

Robo India
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Basics of Embedded C Languagae

Robo India presents the fundamentals of Embedded 'C' Language. Embedded C is very useful to make autonomous robots, embedded system projects, electronics projects, physical computing projects. If you have any query please share your query and views with us. we are found at website: http://roboindia.com mail: [email protected]

Uploaded by

Robo India
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

ROBO INDIA

presents

Basics of Embedded
C Language
Email : [email protected]
Web : www.roboindia.com

Phase 1 | Fundamentals of
Embedded C
Benefits of C language:
o Easier and less time consuming
o Easier to modify and update.
o Codes available in function libraries.
o Portable

www.roboindia.c

Phase 1 | Fundamentals of
Embedded C
Variables
unsigned int x;
x = 10;
Data Type

Size in Bits

Data Range/ Usage

Unsigned char 8 - bit

0 to 255

Signed char

8 - bit

-128 to +127

Unsigned int

16 - bit

0 to 65535

Signed int

16 - bit

-32768 to 32767

sbit

1 - bit

SFR bit addressable only

bit

1 - bit

RAM bit addressable only

sfr

8 - bit

RAM addresses 80- FFH only

www.roboindia.c

Phase 1 | Fundamentals of
Embedded C
Constant
a=20;
#define delay_time 184
Bit Addressable I/O Programming
sbit mybit = P1^5;

www.roboindia.c

Phase 1 | Fundamentals of
Embedded C
HEX Numbers in C
P1 = 0x10; (10 in HEX is 16 in decimal)
P2 = 0xFF; (Set all bits of port 2 to 11111111 or
decimal 255)

www.roboindia.c

Phase 1 | Fundamentals of
Embedded C
Bit-Wise Operations in 8051-C

AND OR

EX-

Inverter

OR
A

A&B A|B A^B

X=~B

0
www.roboindia.c

Phase 1 | Fundamentals of
Embedded C
Bit-Wise Logic Operators in C
P0 = 0x35 & 0x0F; // ANDing, now P0=0x05
P1 = 0x04 | 0x68; // ORing, now P1=0x6C

Bit-Wise Shift Operators in C


1. shift right (>>)
2. shift left (<<)
P2 = 0x9A >> 3; // shifting right 3 times, now
P1=0x13
P2 = 0x77 << 4; // shifting left 4 times, now
P2=0x70

www.roboindia.c

Phase 1 | Fundamentals of
Embedded C
Conditions and Loops
1. If Else
if ( conditions )
{ code to be executed }

2. For loop
for(start ; condition ; step)
{code to be executed}

3. While loop
while( Condition)
{ code to be executed }
www.roboindia.c

Thanks for reading us on slide


share.
Do write us to improvements and
query.

http://roboindia.com
[email protected]

You might also like