embedded systems

55
EMBEDDED SYSTEM” Tank Mitul G

Upload: mitul-tank

Post on 31-Oct-2014

639 views

Category:

Education


0 download

DESCRIPTION

8051 microcontroller

TRANSCRIPT

  • 1. EMBEDDED SYSTEMTank Mitul G

2. What is Embedded Systems An embedded c is a chip which has a computer processer with all its support function memory and i/p o/p built in the device. It includes Hardware and Mechanical parts. Necessity Use in daily life. 3. INTRODUCTION OF C C is a general purpose programming language. C language is developed at AT & Ts Bell Laboratories of USA in 1972. Designed & written by Dennis Ritchie. C is relable,simple & easy to use. Applcation:-mobile phonesComputer gamesSteps in learning C 4. Constant & VariableA variable can be considered as a name given to any memory location.Example: int i; Here i is a name assigned to a particular memory location.A constant is a quantity that does not change. Example: const int i = 500;KeywordsThe keyword cant be used as variable names.The keywords are also called Reserved Words.There are 32 keywords available in C.Some example of keywords:auto, break, case, char, const, while.InstructionsThere are basically four types of instructions in C.Declaration InstructionInput / Output InstructionArithmetic InstructionControl Instruction 5. Data type declarationThere are only a few basic data types in C.1. Integer2. Float Data Type RangeBytes Format3. Double4. Character signed char -128 to + 1271 %c unsigned char0 to 2551 %c short signed int -32768 to +327672 %d short unsigned int 0 to 655352 %u long signed int-2147483648 to +2147483647 4%ld long unsigned int0 to 4294967295 4 %lu Float-3.4e38 to +3.4e384 %f Double -1.7e308 to +1.7e3088 %lf long double-1.7e4932 to +1.7e493210%Lf 6. OperatorsArithmetic OperatorsAssignment OperatorsIncrement / Decrement Operators multiply Operator Example Meaning OperatorMeaning When?*= X=5 X=5 count++ count = count + 1;After use/divide +=X += 5X=X+5++count count = count + 1;Before%reminder=X=5X=X5use /= X /= 5 X=X/5count-- count = count 1;After use+Add *=X *= 5X=X*5 Subtract--count count = count 1;Before-%=X %= 5X=X%5use Logical OperatorsBitwise Operators Exponentiation Operators&bitwise ANDExponentiation is not written as x**2 or x^2 ! (not)|bitwise OR C does not have an exponentiation operator. a != b is true if a and b are not equal^bitwise X-OR You can use the math function pow(a, b) && (and) > Right Shift 5>6 && 7>4 is not true (i.e. false) || (or)~ones complement 54 is true, and 5>6 || 7>4 is also true 7. CONDITIONAL STATEMENTThe if-else statementThe if statement(a) if ( condition )(a) if ( condition ) (b) if ( condition ) (c) if ( condition ) do this ; do this ; do this ;{(b) if ( condition ) else elseif ( condition ) { do this ; {do this ; do this ; if ( condition ) else and this ;do this ; {}else do this ; {and this ; do this ;} The conditional operatorsand this ; expression 1 ? expression 2 : expression 3 } }else char a ;}do this ; int y ; scanf ( "%c", &a ) ; y = ( a >= 65 && a =65 && a