Semester : SEMESTER 6
Subject : Embedded System
Year : 2018
Term : MARCH
Scheme : 2015 Full Time
Course Code : EC 308
Page:30
Difference between Macro and Function
* The codes for a function compiled once only
* On calling that function, the processor has to save the context, and on return restore the
context.
* Macros are used for short codes only.
* When a function call is used instead of macro, the overheads (context saving and return)
will take
a time, Toverheads that is the same order of magnitude asthe time, Texec for execution of
short codes within a function.
* Use the function when the Toverheads<
>Texec.
Use of Modifiers
auto ا
ட unsigned
ட static
ட const
_ register
ட inlerrupl
_ extern
ட volatile
ட volatile stalic
Use of infinite loops
_ Infinite loops- Never desired in usual programming. Why? The program will never end and
never exit or proceed further to the codes after the loop.
_ Infinite loop is a feature in embedded system programming!
Use of Pointers
Pointers are powerful tools when used correctly and according to certain basic principles.
# define COM ((structsio near*) 0x2F8);
This statement with a single masterstroke assigns the addresses to all 8variables
Byte at the sio Addresses
0218: Byte at RBR/THR /DLATCH-LByte
0219: Byte at DLATCH-HByte