Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Embedded System

Embedded System

|Views: 28|Likes:
Published by Assini Hussain
Lecture Notes of Embedded System; Reference:- Raj Kamal
Lecture Notes of Embedded System; Reference:- Raj Kamal

More info:

Published by: Assini Hussain on Nov 19, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





08.716 Embedded SystemModule 2
S/W programming concept in embedded systems:1.Assembly language programmingAdvantages:
Codes are sensitive to the processor, memory, ports and device hardware . It give precisecontrol of the processor internal devices and complete usage of processor-specific features
Require only smaller memory. Program is not a compiler specific
Device driver by assembly code need only a few instructions
Suitable for bottom-up design approach2.High level language programmingEg: C, C++ or JavaAdvantages:
Program development cycle is short even for complex systems because of the use of subroutines, std library functions etc.
Facilitates data-type declarations
Facilitates type checking
Facilitates use of control structures and conditional statements to specify program flow
Has probability of non-processor-specific codes
C as a high level language is a language b/w low and high level languageC program elements:
Structural elements in C program are:
Pre-processor declarations, definitions and statements
Main function
Functions, exceptions and ISRs
Preprocessor structural elements has:
Include directive for file inclusion
Definitions for preprocessor global variables
Definitions of constants
Declarations for global data type, type declaration and data structures, macros and functions
Include directive for inclusion files:
Include is a preprocessor directive to include the contents (code or data) of a file
The requirements for include files are:
Including code files (.c files)
Including constant data files (.const files)
Including strings data files (.strings or .str or .txt files)
Including initial data files (shadow of ROM, .init files)
Including basic variable files (local or global static variables, .bss files)
Including header files (contents of a set of source files, .h files)
Department of ECE, VKCETPage 1
08.716 Embedded SystemModule 2
Some examples of include fles:
Source files:
Program files for the functions of application software
Need to be compiled
Will possess the preprocessor directives of the application and have first function where the processing will start and is called main, usually
void main()
Configuration files:
Files for configuring the system
If configuration codes are in the file named
, then preprocessor directive is
#include “serialLine_cfg.h”
Preprocessor directives:
Preprocessor global variables: For example, in a program the IntrEnable, InterDisable may beglobal variables for disabling or enabling interrupts. Then preprocessor directive is
#definevolitile boolean InterEnable
Preprocessor constants: Example is
#define false 0
means it is a directive before processing to assume
as 0Another example is
#define portA (volitle unsigned char *) 0x1000
is the address fixed for portA register Strings are constant and a directive example is
#define welcome ‘Welcome to Kerala’ 
Program elements:Macros and functions
The use of these elements are:
Macros: Executes a named small collection of codes
Functions: Executes a named set of codes with values passed by calling program through itarguments. Also returns a data objectPreprocessor macros:
Collection of code that is defined in a C program by a name
Compiler puts the corresponding codes for it every place where that macro name appears
An eg. ‘enable_Maskable_Intr( ) and ‘disable_Maskable_Intr’. When ever the name appear thecompiler places the code designed for it
Test macros or test vectors are designed during programming and are used for debugging
Department of ECE, VKCETPage 2
08.716 Embedded SystemModule 2
Difference between macros and functions:
Codes for function are compiled once only. On calling it save content, return nothing, or a typeof data value
Code for macro compiled in every function wherever that macro name is used. On using it doesnot save the content, does not return data
Macros used for short codes only, but functions notUse of Data types:
Have address allocated at the memory. Number of address depends on data types
Primitive data types in C:
char (8 bits) for characters
 byte (8 bits)
unsigned short (16 bits)
short (16 bits)
unsigned int (32 bits)
int (32 bits)
long double (64 bits)
float (32 bits)
double (64 bits)
typedef is used to create data typeAn eg:
typedef unsigned character portAdata#define Pbyte portAdata 0xF0
Use of pointers and Null pointers:
Pointers are powerful tool
It is a reference to starting memory address
Can refer to variable, data structure or function
Eg: unsigned char *0x1100 means a character eight bit address 0x1100
 NULL pointer declares:
#define NULL (void)*0x0000, we can assign any address instead of 0x0000 that is not in agiven hardware
Exemplary uses of pointers are:1.Consider ‘unsigned short *timer1’. The computer will reserve two memory addresses for the contents of timer1. Consider the statement timer1++, it adds 0x0002 in the address of timer1 (for a 16 bit timer address)2.Consider ‘unsigned byte *portA’, means that there is a pointer and an unsigned byte for  port A and the compiler will reserve one memory address for that byte3.Consider the declaration, void *portAdata: the void is the undefined data type for  portAdata, the compiler will allocate address for the *portAdata without any type check 
Department of ECE, VKCETPage 3

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->