This document discusses embedded C programming. It defines embedded C and compares it to conventional C and assembly programming. Key differences between embedded C and other languages include embedded C being microcontroller dependent rather than processor dependent, more portable code, and easier readability. Embedded C allows direct hardware access and optimization for limited embedded systems. The document outlines rules for developing optimized embedded C programs, including scope of variable declarations, function parameters, and register usage. Cross-compilers are used to compile embedded C code into executable hex files for microcontrollers.
We are one of the best embedded systems training institute for advance courses. We are the pioneer of the embedded system training in Pune & Pcmc with the expertise of over 16 years. we are working in the field training & development of embedded systems & currently we are also working on live projects as per the requirements of clients. though we provide many different courses & training in embedded all aim at giving good practical knowledge to students as well help them in their career.
In 2020, the Ministry of Home Affairs established a committee led by Prof. (Dr.) Ranbir Singh, former Vice Chancellor of National Law University (NLU), Delhi. This committee was tasked with reviewing the three codes of criminal law. The primary objective of the committee was to propose comprehensive reforms to the country’s criminal laws in a manner that is both principled and effective.
The committee’s focus was on ensuring the safety and security of individuals, communities, and the nation as a whole. Throughout its deliberations, the committee aimed to uphold constitutional values such as justice, dignity, and the intrinsic value of each individual. Their goal was to recommend amendments to the criminal laws that align with these values and priorities.
Subsequently, in February, the committee successfully submitted its recommendations regarding amendments to the criminal law. These recommendations are intended to serve as a foundation for enhancing the current legal framework, promoting safety and security, and upholding the constitutional principles of justice, dignity, and the inherent worth of every individual.
We are one of the best embedded systems training institute for advance courses. We are the pioneer of the embedded system training in Pune & Pcmc with the expertise of over 16 years. we are working in the field training & development of embedded systems & currently we are also working on live projects as per the requirements of clients. though we provide many different courses & training in embedded all aim at giving good practical knowledge to students as well help them in their career.
In 2020, the Ministry of Home Affairs established a committee led by Prof. (Dr.) Ranbir Singh, former Vice Chancellor of National Law University (NLU), Delhi. This committee was tasked with reviewing the three codes of criminal law. The primary objective of the committee was to propose comprehensive reforms to the country’s criminal laws in a manner that is both principled and effective.
The committee’s focus was on ensuring the safety and security of individuals, communities, and the nation as a whole. Throughout its deliberations, the committee aimed to uphold constitutional values such as justice, dignity, and the intrinsic value of each individual. Their goal was to recommend amendments to the criminal laws that align with these values and priorities.
Subsequently, in February, the committee successfully submitted its recommendations regarding amendments to the criminal law. These recommendations are intended to serve as a foundation for enhancing the current legal framework, promoting safety and security, and upholding the constitutional principles of justice, dignity, and the inherent worth of every individual.
A "File Trademark" is a legal term referring to the registration of a unique symbol, logo, or name used to identify and distinguish products or services. This process provides legal protection, granting exclusive rights to the trademark owner, and helps prevent unauthorized use by competitors.
Visit Now: https://www.tumblr.com/trademark-quick/751620857551634432/ensure-legal-protection-file-your-trademark-with?source=share
ALL EYES ON RAFAH BUT WHY Explain more.pdf46adnanshahzad
All eyes on Rafah: But why?. The Rafah border crossing, a crucial point between Egypt and the Gaza Strip, often finds itself at the center of global attention. As we explore the significance of Rafah, we’ll uncover why all eyes are on Rafah and the complexities surrounding this pivotal region.
INTRODUCTION
What makes Rafah so significant that it captures global attention? The phrase ‘All eyes are on Rafah’ resonates not just with those in the region but with people worldwide who recognize its strategic, humanitarian, and political importance. In this guide, we will delve into the factors that make Rafah a focal point for international interest, examining its historical context, humanitarian challenges, and political dimensions.
Matthew Professional CV experienced Government LiaisonMattGardner52
As an experienced Government Liaison, I have demonstrated expertise in Corporate Governance. My skill set includes senior-level management in Contract Management, Legal Support, and Diplomatic Relations. I have also gained proficiency as a Corporate Liaison, utilizing my strong background in accounting, finance, and legal, with a Bachelor's degree (B.A.) from California State University. My Administrative Skills further strengthen my ability to contribute to the growth and success of any organization.
Responsibilities of the office bearers while registering multi-state cooperat...Finlaw Consultancy Pvt Ltd
Introduction-
The process of register multi-state cooperative society in India is governed by the Multi-State Co-operative Societies Act, 2002. This process requires the office bearers to undertake several crucial responsibilities to ensure compliance with legal and regulatory frameworks. The key office bearers typically include the President, Secretary, and Treasurer, along with other elected members of the managing committee. Their responsibilities encompass administrative, legal, and financial duties essential for the successful registration and operation of the society.
Synopsis On Annual General Meeting/Extra Ordinary General Meeting With Ordinary And Special Businesses And Ordinary And Special Resolutions with Companies (Postal Ballot) Regulations, 2018
How to Obtain Permanent Residency in the NetherlandsBridgeWest.eu
You can rely on our assistance if you are ready to apply for permanent residency. Find out more at: https://immigration-netherlands.com/obtain-a-permanent-residence-permit-in-the-netherlands/.
2. •Whenever the conventional „C‟ language and
its extensions are used for programming
embedded systems, it is referred to as
“Embedded C” programming.
What is a EMBEDDED C?
4. ASSEMBLY V/S EMBEDDED C
The assembly code is difficult to read and maintain.
The amount of code reusable from assembly code is very low.
C programs are easy to read, understand, maintain, because it
possesses greater structure.
With C the programmer need not know the architecture of the
processor.
Code developed in C will be more portable to other systems rather than
in assembly.
5. ASSEMBLY
Org 00h
mov r1,#05h
mov r2,#06h
mov a,r1
add a,r2
mov r3,a
end
COMPARISON BETWEEN ASSEMBLY AND EMBEDDED C PROGRAM
EMBEDDED C
main( )
{
unsigned int
a,b,c; a=0x5;
b=0x6;
c=a+b;
Printf (“ %x”,c);
}
6. DIFFERENCE BETWEEN CONVENTIONAL C AND EMBEDDED C.
Compliers for conventional C are TC, BC
Compilers for Embedded C are keil µvision - 2 & 3, PIC C etc.
Conventional C programs needs complier to compile the
program & run it.
The embedded C program needs a cross compiler to compile &
generate HEX code.
The programs in C are basically processor dependent whereas
Embedded C programs are micro controller dependent.
7. DIFFERENCE BETWEEN CONVENTIONAL C AND EMBEDDED C.
The C program is used for developing an application and not
suitable for embedded systems.
The embedded C is an extension of the conventional C. i.e
Embedded C has all the features of normal C, but has some
extra added features which are not available in C.
Many functions in C do not support Reentrant concept of
functions.
8. DIFFERENCE BETWEEN CONVENTIONAL C AND EMBEDDED C.
C is not memory specific. i.e variables cannot be put in the
desired memory location but the location of variable can be
found out.
In embedded C this can be done using specific inbuilt
instructions.
C depends on particular processor or application.
Embedded C is Controller or target specific.
Embedded C allows direct communication with memory.
9. Why C for Micro controllers
Compatibility
Direct access to hardware address
Direct connection to interrupts
Optimization consideration
Development environment
Reentrancy
10. PROGRAM FLOW IN CROSS COMPILERS
EDITOR Notepad
or Dos
.C .H .ASM .A51
COMPLILER ASSEMBLER
.OBJ .OBJ
Linker / Locator
HEX file
To Micro
Controller
11. BIT LEVEL PROGRAMMING & OPTIMIZATION
Embedded C offers a unique concept of bit level programming.
This concept is mainly used to declare a variable that will be
stored in the bit addressable area of data memory.
This is very useful because the variable declared in this fashion
directly points the data in a particular segment of memory.
Structures and Unions are possible in bit operation. The bits of
the variable can be accessed without using previously declared
bit names.
12. BIT LEVEL PROGRAMMING & OPTIMIZATION
It can be defined in a simple way as
Ex: Unsigned char bdata a=10;
bit =b;
b=a^3;
(a=(10)d => ‘0a’ =0000 1010)
b = 1;
After the final execution , the value of b is 1.
Limitations of bit level program
Bit pointer is invalid.
Array of bits is invalid.
13. STARTUP CODE
Startup code is an extra piece of software that executes prior to main().
The startup code is generally written in assembly language and linked
with any executable that you build.
It prepares the way for the execution of programs written in a high-level
language.
Each such language has its own set of expectations about the run-time
environment in which programs are executed.
For example, many languages utilize a stack. Space for the stack must be
allocated and some registers or data structures initialized before
software written in the high-level language can be properly executed.
14. EMBEDDED SOFTWARE DEVELOPMENT
The embedded software development tools, cannot make assumption
about the target platform.
The user has to provide some details of the system to the tools through
explicit statements or instructions.
Once these data are given to the tools, these tools generate the expected
outputs on the computer system itself so that the programmer can
analyze or make suitable changes in the software to get the desired
output.
15. REENTRANCY, STATIC, VOLATILE KEYWORDS
A variable is a named object that resides in the RAM.
In C programs each function call causes a frame to be pushed on to stack
which contains function parameters and allocation of the locals of the
functions.
In embedded C there is no stack allocated .
In a block of memory, a function is given a fixed address space for its local
variables .
Thus recursive calls to a function will cause the data in the variables to be
corrupted.
16. REENTRANCY, STATIC, VOLATILE KEYWORDS
In this, a separate copy of the locals for each function exists.
Because the stack is simulated reentrant functions are large.
Care should be taken that these function do not cross the
memory limitations when copies of the functions are created.
This also requires the elimination of any bit parameters, locals
and return values from reentrant functions.
19. VOLATILE MODIFIERS
Volatile is global variable.
These are specifically used in case of ports or interrupts.
Features :
Volatile takes 1 byte instruction.
Permanent memory location is allotted.
Type casting is not possible.
No optimization.
Volatile can modify the value dynamically.
Volatile modifier can change the value outside the scope of function.
21. VOLATILE MODIFIERS
Volatile modifier can change the value outside the scope of the function.
Usually the value of global variable changes only as a result of explicit
statements in C functions i.e. currently executing.
Without volatile modifier the compiler may look at the two statements in
main and conclude that since the while loop does not modify time it could
never reach 100.
Volatile modifier disables the optimization and forces the prg to fetch a
new value from that variable each time the variable is accessed.
22. CREATING ENVIRONMENT VARIABLES
Declaring a variable involves 2 actions. First action is declaring the type
and second action is defining it in memory.
E.g.
1. Unsigned char a; 8 bit unsigned number.
2. Char c1; 8 bit unsigned numbers.
3. Unsigned int a; 16 bit unsigned number.
4. int i; 16 bit signed number.
5. Short s; 16 bit signed number.
6. Long l1; 4 signed 32 bit integer.
7. Float & double are not used/ preferred in embedded C programs.
24. CREATING ENVIRONMENT VARIABLES
Declaring a variable involves 2 actions. First action is declaring the type
and second action is defining it in memory.
E.g.
1. Unsigned char a; 8 bit unsigned number.
2. Char c1; 8 bit unsigned numbers.
3. Unsigned int a; 16 bit unsigned number.
4. int i; 16 bit signed number.
5. Short s; 16 bit signed number.
6. Long l1; 4 signed 32 bit integer.
7. Float & double are not used/ preferred in embedded C programs.
25. CREATING EXECUTABLE PROGRAMS, TEMPORARY
FILES,INCLUDE FILES AND LIBRARY FILES.
The C source code is compiled using c51 compiler by invoking C51.exe.
The command line is C51 source files [directives….] where Source files: is
the name of the source program to be compiled. Directive: are directives
to the compiler to control the function of the compiler
The source code is usually developed in C or assembly which are
executable programs.
C51 compiler generates a series of output files during compilation.
Basename.lst : (list file) these contain formatted source text with any
errors detected by the compiler .
26. CREATING EXECUTABLE PROGRAMS, TEMPORARY
FILES,INCLUDE FILES AND LIBRARY FILES.
Basename.obj: (object code) These contain the relocatable object
code.These are linked to an absolute module by L51 linker/locator.
Basename.I:contains source text as expanded by the preprocessor.All macros
are expanded and all comments are deleted on this listing.32
Basename.src: these are assembly source files generated from c source
code.These are assembled with A51 assembler.
Basename.hex (I): this is a hex file or a binary file used to program the
device.
27. Include files:
Embedded c program needs some important include and library files.Include
files includes mainly the header files which are required to convert the
source code suitable for application or device
Some of the most common header files used in the PIC18F458 are
“PIC16Fxx.h”.
Some of the important library functions are inbuilt features that help the
user to access the internal memory location as well as external hardware
pins of the device.
Some of these header files as well as the library functions are not available
in conventional C.
CREATING EXECUTABLE PROGRAMS, TEMPORARY
FILES,INCLUDE FILES AND LIBRARY FILES.
28. The most commonly used compilers are keil- 2,3 , Pic C and Hitech C. In Keil
micro-vision 2 or 3, A new project has to be created in the start. For that
project, a target, usually a controller which is used for the application is
selected . For that project a source group is added. Source group usually
contains the source code files. Once the source code is developed ,this code is
compiled by the cross compiler. This compilation is usually called as “Build”.
During this stage, object files are created by the compiler. After compilation,
these are linked to the linker which produces a .hex code.These code formats
are suitable for the micro controller.
CREATING EXECUTABLE PROGRAMS, TEMPORARY
FILES,INCLUDE FILES AND LIBRARY FILES.
30. Code Optimization.
Declare local variables in the inner most scope
Do not declare all the local variables in the outermost function scope.
If local variables are declared in the inner most scope.
If the parameter was declared in the outermost scope, all function calls
would have incurred the overhead of object .
Place case labels in narrow range
If the case labels are in a narrow range, the compiler does not generate
a if-else-if cascade for the switch statement.
This code generated is faster than if-else-if cascade code that is
generated in cases where the case labels are far apart.
RULES FOR DEVELOPING EMBEDDED C PROGRAM
31. Reduce the number of parameters Function calls with large number of
parameters may be expensive due to large number of parameter pushes on stack
on each call. For the same reason, avoid passing complete structures as
parameters. Use pointers and references in such cases.
Use references for parameter passing and return value for types bigger than 4
bytes
Passing parameters by value results in the complete parameter being copied
on to the stack. This is fine for regular types like integer, pointer etc. These
types are generally restricted to four bytes. When passing bigger types, the
cost of copying the object on the stack can be prohibitive. When the function
exits the destructor will also be invoked.
RULES FOR DEVELOPING EMBEDDED C PROGRAM
32. SFRS & Registers
1. Use All the SFR’s in capital letters only.
2. Reduce the warnings in the program.
3. Make use of MACRO definitions in the program.
4. Always define the variables in the code memory by using the keyword
code in declaration.
5. Eg unsigned int code a[] = { };
6. Always define as unsigned type of declaration.
7. Make use of sbit definition for single bit declaration.
8. Eg sbit rs = P3^6;
RULES FOR DEVELOPING EMBEDDED C PROGRAM
33. So we cannot define the above declaration as sbit rs = P3.6.
The declaration like this below are invalid. P3^6 = 0;
P3^6 is bit addressable type & 0 is a 8 bit data which cannot be stored in
single bit.
Permanent termination of the program is got by using while(1);
Infinite loop can be achieved by
while(1)
{
………
}
RULES FOR DEVELOPING EMBEDDED C PROGRAM