Difference in Embedded C an C

download Difference in Embedded C an C

of 15

Transcript of Difference in Embedded C an C

  • 8/9/2019 Difference in Embedded C an C

    1/15

    Presented By:Ns-Sidra Rashid

  • 8/9/2019 Difference in Embedded C an C

    2/15

    A programming language is an artificiallanguage designed to express

    computations that can be performed bya machine, particularly a computer. ...

  • 8/9/2019 Difference in Embedded C an C

    3/15

    A programming language is used towrite computerprograms such as

    Applications

    Utilities

    Servers

    Systems Programs

  • 8/9/2019 Difference in Embedded C an C

    4/15

    A program is written as a series of humanunderstandable computer instructions

    that can be read bya compilerand linker, and translatedinto machine code so that a computercan understand and run it.

  • 8/9/2019 Difference in Embedded C an C

    5/15

    Now programms can be written indifferent languges I wil discuss two of

    them,along with their pros and cons,theirfeatures.

    One is C++ and other is Embedded C.

  • 8/9/2019 Difference in Embedded C an C

    6/15

    C++ is a general purpose programminglanguage,which has the following

    special features : data abstraction

    object-oriented programming

    generic programming

  • 8/9/2019 Difference in Embedded C an C

    7/15

    Embedded C++ (EC++) is a dialect ofthe C programming language

    for embedded systems. Why EC?

    Minimize code size

    Maximizing execution efficiency Simpler Compiler construction

  • 8/9/2019 Difference in Embedded C an C

    8/15

    Embedded C++ is a proper subset of C++. The followinglanguage features have been removed:

    Multiple inheritance Virtual base classes Run-time type information (typeid) New style casts

    (static_cast, dynamic_cast, reinterpret_cast and const_cast)

    The mutable type qualifier

    Namespaces Exceptions Templates The stated reason for removing language features was

    stated as "too new to be used widely

  • 8/9/2019 Difference in Embedded C an C

    9/15

    An EC++ program can be compiled withany C++ compiler.

    However a compiler specific to EC++ mayhave an easier time doing optimization.

    While a C++ programme can only be runusine c compiler.

  • 8/9/2019 Difference in Embedded C an C

    10/15

    It aims to provide portability and access tocommon performance-increasing embeddedprocessing.

    The Embedded C specification for fixed-point,named address spaces,and named registers givesthe programmer direct access to features in thetarget processor.

    The hardware I/O extension is a portability featureof Embedded C.

    Its goal is to allow easy porting of device-drivercode between systems.

  • 8/9/2019 Difference in Embedded C an C

    11/15

    In the C standard, a standaloneimplementation doesn't have to provide all ofthe library functions that a hosted

    implementation has to provide. The C standard doesn't care about

    embedded, but vendors of embedded systemsusually provide standalone implementations

    with whatever amount of libraries they're willingto provide.

  • 8/9/2019 Difference in Embedded C an C

    12/15

    #include

    void wait (void) { ; }

    void main (void) { unsigned int i;

    unsigned char j;

    while (1) { infinite loop for(j=0; j= 6; j--) { /* Blink LED 6, 5, 4, 3, 2, 1 */ outputtoled = j; /* Output to LED Port */ for(i = 0; i < 10000; i++) { /* Delay for10000 Counts */ wait (); /* call wait function */ } } } }

  • 8/9/2019 Difference in Embedded C an C

    13/15

    // a simple programme to make the a pattern of led on with regular intervals #include

    void wait (void) { /* wait function */ ; /* only to delay for LED flashes */ }

    void main (void) { unsigned int i; /* Delay var */ unsigned char j; /* LED var */

    while (1) { /* Loop forever */ for(j=0x02; j< 0x80; j>=1) { /* Blink LED 6, 5, 4, 3, 2, 1 */ P1 = j; /* Output to LED Port */ for(i = 0; i < 10000; i++) { /* Delay for10000 Counts */ wait (); /* call wait function */ } } } }

  • 8/9/2019 Difference in Embedded C an C

    14/15

    I/O Hardware Addressing

    Embedded C Portability

    Scheme For EC: Data lines, bits, nibbles, bytes, words, binary

    and HEX.

    Boolean Logic as it relates to programming aswell as the hardware.

    Putting It All Together - Controlling TheHardware With The Software.

    Is used for signal conversions,controlling motors

  • 8/9/2019 Difference in Embedded C an C

    15/15

    Embedded c deals with MicroControllers

    IO Ports( Ram, Rom).its more efficient.

    Where as C deals with only memory,operatingSystems.

    C is a desktop programming language.

    for embedded a piece of software codeis implemented into the hardware for itsfunctioning which should supports pre-emption, low latency etc