Upload
ishantkathuria
View
627
Download
51
Embed Size (px)
DESCRIPTION
avr microcontroller
Citation preview
Advance Real Time Embedded Systems
A Training Project ReportOn
“line follower robot”
Submitted to
Maharishi Markendeshwar University
In the partial fulfillment of the requirement for the award of the degree of
B-Tech
Session: 2009-2013
Table of Content
M.M.E.C. Mullana Page 1
SUBMITTED BY:
ISHANT
11090402
E.C.E B1
7thSem.
SUBMITTED to:
ER. JYOTI GUPTA
E.C.E Department
Advance Real Time Embedded Systems
1.0 Introduction of Organization......................................................................................1-6
1.1 History................................................................................................................11.2 NIIT Bombay......................................................................................................21.3 Acknowledgement..............................................................................................41.4 Franchise Support...............................................................................................51.5 Franchise Process................................................................................................6
2.0 Introduction of Embedded C......................................................................................7-14
2.1 Variety of Embedded C.......................................................................................92.2 Characteristics......................................................................................................102.3 User Interface.......................................................................................................102.4 Process in Embedded C........................................................................................112.5 Reliability..............................................................................................................112.6 Peripherals.............................................................................................................122.7 Tools......................................................................................................................13
3.0 PROJECT....................................................................................................................14-15
4.0 Important Terms used in Project..............................................................................16-20
4.1 ATMEL (AVR)...................................................................................................16 4.1.1 Brief History...........................................................................................16 4.1.2 Basic Families.........................................................................................16
4.2 UART..................................................................................................................18 4.2.1 Transmitting/Receiving Serial Data......................................................18
5.0 Conclusion...................................................................................................................20
6.0 Bibilography...................................................................................................................
1.0 Introduction of Organization :
M.M.E.C. Mullana Page 2
Advance Real Time Embedded Systems
1.1 HISTORY:
1981
The company was incorporated on December 2, under the name of Pace.Education Private
Limited. The company was promoted by Shri S.S.Nadar, Shri. V.K. Thadani, Shri. R.S.
Pawar and Smt. Kiran Nadar.
The company began its operation by developing, marketing and implementing technical
know-how packagesfor Education or Training.Consultancy & data processing in the field of
Information Technology.
1982:
The first Computer Education Centre was set up at Mumbai and later in the same year
another centre was opened in Delhi.
1988:
On 27th October company became a Public Limited company.
1990:
On 16th November, the name of the Company was changed to NIIT Limited.
1992:
A contract was signed with Software Publishing Corporation (SPC)for developing an
enhanced version of one of the SPC's own' products.
The Company successfully introduced two new facilities in the form of `Computerdromes'
and the `Carry Home PC', which were received very well.
M.M.E.C. Mullana Page 3
Advance Real Time Embedded Systems
The Company developed curicula for professional sales and Marketing which are offered
through the National Institute of Sales (NIS) at New Delhi and Chennai.
The company undertook to set up six software factories at New Delhi,Mumbai and Chennai.
The company also undertook to set up additional automated learning centres at Mumbai,
Calcutta, Delhi and Chennai.
The company proposed to modernise the career education product line with main thrust on
the provision of additional computer in gre sources in two forms.
1.2 NIIT (Bombay) :
NIIT is a leading Global Talent Development Corporation,
building skilled manpower pool for global industry
requirements. The company which was set up in 1981, to
help the nascent IT industry overcome its human resource
challenges, has today grown to be amongst world’s leading
talent development companies offering learning solutions
to Individuals, Enterprises and Institutions across 40
countries.
NIIT’s training solutions in IT, Business Process
Outsourcing, Banking, Finance and Insurance, Executive
Management Education, and Communication and
Professional Life Skills, touch five million learners every
year. NIIT’s expertise in learning content development,
training delivery and education process management make
it the most preferred training partner, worldwide.
Leading IT magazine Dataquest has conferred upon NIIT,
the ‘Top IT Training Company’ award successively for
the past 18 years, since the inception of this category.
Research-based Innovation, a key driver at NIIT, has enabled the organisation to develop
programs and curricula that use cutting-edge instructional design methodologies and training
delivery. NIIT’s Individual Learning Business offerings include industry-endorsed programs
M.M.E.C. Mullana Page 4
Advance Real Time Embedded Systems
for students seeking careers in IT – New Age GNIIT (India’s First Cloud
Campus), Edgeineers and Global Net Plus for IT professionals.
For working professionals, NIIT Imperia, Centre for Advanced Learning, offers Executive
Management Education Programs in association with IIM Ahmadabad, IIM Calcutta, IIM
Lucknow, IMT Ghaziabad and IIFT Delhi. NIIT Imperia also offers specialized courses in
Finance in association with KPMG and on Digital Marketing with Google India and Internet
and Mobile Association of India (IAMAI).
NIIT Institute of Finance Banking & Insurance (IFBI), formed by NIIT with equity
participation from ICICI Bank, offers programs for individuals and corporates in Banking,
Financial Services and Insurance.
NIIT Uniqua, Centre for Process Excellence, addresses the increasing demand for skilled
workers in the business and technology services industry by providing training programs in
relevant areas. This is a part of NIIT Institute of Process Excellence, a NIIT-Genpact venture.
NIIT Careers@Campus, the company’s Institutional Alliances Business for colleges and
Universities, delivers in-campus training through Synchronous Learning Technology.
NIIT’s Corporate Learning Solutions, NIIT’s Corporate Learning Solutions, offers integrated
learning solutions (including strategic consulting, learning design, content development,
delivery, technology, assessment and learning management) to Fortune 500 companies,
Universities, Technology companies, Training corporations and Publishing houses.
NIIT’s innovative HR practices have been felicitated by Aon Hewitt as amongst ‘Top 25
Best Employers in India- 2011’; Education Awards 2011 as ‘Best Education Company to
Work with’; by Places to Work Institute as amongst ‘Top 25 India’s Best Companies to
Work for’ and First in Training & Education Industry, 2011.
Ushering in a new model in higher education is the not-for-profit NIIT University,
established in 2009 with a vision of being the leading centre of innovation and learning in
emerging areas of the Knowledge Society. Nestled in the foothills of Aravali, in Neemrana,
Rajasthan, the picturesque 100 acres fully residential green campus has been developed as an
institute of excellence based on the four core principles of providing industry linked,
technology based, research driven, seamless education.
1.3 ACKNOWLEDGEMENT:
NIIT has been conferred the 'Franchisor of the Year Award 2011' by Franchise India
M.M.E.C. Mullana Page 5
Advance Real Time Embedded Systems
NIIT ranked amongst the Top 25 list of ‘India’s Best Companies to Work for –
2011’ by Great Place to Work Institute & Economic Times.
NIIT featured in Aon Hewitt's Top 25 list of 'Best Employers in India-2011'.
NIIT has received the 'Best Education Company to Work with' award at the Indian Education
Awards 2011, organized byFranchise India.
NIIT was conferred the 'Top IT Training Company Award 2011' by the country's leading
publication group Cybermedia, the publisher of Dataquest. (NIIT has been getting this award
successively for the past 18th years, since the inception of this category).
NIIT received the Best Learning Partner award from CISCO and Microsoft in 2010-11.
Great Place to Work Institute in association with Economic Times ranks NIIT as 1st in
Education & Training Sector in‘India’s Best Companies to Work for - 2011’ study.
Ranked amongst 'India's Most Trusted Education Brand' in Economic Times Brand Equity
survey in 2011
NIIT has been awarded ‘Franchisor of the Year in Education: Information
Technology’ by Franchise Plus Magazine in 2010
NIIT received the ICT Gold Medal – Vietnam for the 4th year in a row in July 2009
NIIT received the Best Learning Partner award from CISCO and Microsoft in 2009
NIIT’s Institute of Finance, Banking and Insurance (IFBI) was recognized as the Best
Training School by The Week – Nielsen survey in 2009
NIIT has been accorded the Business Superbrands 2008 status for the second time by the
Superbrands Council.
Ranked amongst India's 'Most Respected Companies' in the IT sector in a survey done by
Business World magazine in 2007.
NIIT was ranked as 'India's Most Customer Responsive Educational Institution' as per Avaya
Global Connect Customer Responsiveness Awards in 2007 for the third consecutive year.
The company was awarded the 'Indian Franchisor of the Year Award' in 2007 by Franchising
Association of India.
M.M.E.C. Mullana Page 6
Advance Real Time Embedded Systems
NIIT was ranked amongst the 'Top 10 Business Brands since 60 years of Independence', by a
leading Indian magazine'The Week' in 2007.
NIIT is the only Indian Education company to be featured in "The BCG 50 Local Dynamos".
NIIT HiWEL wins the prestigious Mac Arthur Digital Media and Learning Award.
NIIT has been honoured as the - 'Most influential IT Training brand in China', on the eve of
60 years of People's Republic of China (PRC) celebrations.
1.4 FRANCHISE SUPPORT:
Training Support:
NIIT organizes induction programmes for new Business Partners and their staff.
It undertakes Faculty and Counselor training and certification.
It hosts sales and marketing training periodically.
NIIT conducts ongoing training on new products.
Systems Support:
The company designs the admission process.
It conducts online examinations for students.
NIIT offers a special data management system for maintaining student records and managing
centre operations.
Marketing and Advertising Support:
NIIT takes marketing and advertising initiatives at a national level.
For region specific advertising NIIT provides aid to Business Partners, which is subject to
minimal charge.
NIIT offers new Business Partners an initial start-up kit containing product brochures and
promotional material, which is subject to a minimal charge.
1.5 FRANCHISE PROCESS:
M.M.E.C. Mullana Page 7
Advance Real Time Embedded Systems
Educational Qualifications:
Candidate should be a graduate in any discipline.
Financial Qualifications:The individual should possess the ability to mobilise resources
through internal and external means. He/she should have the capability to personally invest
around 50-60 percent of the total project cost.
Business experience and skills:
The individual should possess 1-3 years of experience in any functional area, preferably at
the middle management level.
Be a First time Entrepreneur.
Be Self employed in Business.
Commitment:
Alacrity to share vision and values of NIIT in the field of IT education.
Commitment to devote full time attention to the venture or to source professional help in
running the venture.
Geographical knowledge:
The candidate should have complete knowledge of the regional market.
2.0 Introduction to Embedded C:
M.M.E.C. Mullana Page 8
Advance Real Time Embedded Systems
Embedded C is a set of language extensions for the C Programming language by the
Standards committee to address commonality issues that exist between C extensions for
different embedded systems. Historically, embedded C programming requires nonstandard
extensions to the C language in order to support exotic features such as fixed-point
arithmetic, multiple distinct memory banks, and basic I/O operations.
An embedded system is a computer system designed for specific control functions within a
larger system, often with real-time computing constraints. It is embedded as part of a
complete device often including hardware and mechanical parts. By contrast, a general-
purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a
wide range of end-user needs. Embedded systems control many devices in common use
today.
Embedded systems contain processing cores that are either microcontrollers or digital signal
processors (DSP). The key characteristic, however, is being dedicated to handle a particular
task. Since the embedded system is dedicated to specific tasks, design engineers can optimize
it to reduce the size and cost of the product and increase the reliability and performance.
Some embedded systems are mass-produced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and MP3
players, to large stationary installations like traffic lights,factory controllers. Complexity
varies from low, with a single microcontroller chip, to very high with multiple
units, peripherals and networks mounted inside a large chassis or enclosure.
M.M.E.C. Mullana Page 9
Advance Real Time Embedded Systems
In 2008, the C Standards Committee extended the C language to address these issues by
providing a common standard for all implementations to adhere to. It includes a number of
features not available in normal C, such as, fixed-point arithmetic, named address spaces, and
basic I/O hardware addressing.
Embedded C use most of the syntax and semantics of standard C, e.g., main() function,
variable definition, datatype declaration, conditional statements (if, switch. case), loops
(while, for), functions, arrays and strings, structures and union, bit operations, macros,
unions,etc
Looking around, we find ourselves to be surrounded by various types of embedded systems.
Be it a digital camera or a mobile phone or a washing machine, all of them has some kind of
processor functioning inside it. Associated with each processor is the embedded software. If
hardware forms the body of an embedded system, embedded processor acts as the brain, and
embedded software forms its soul. It is the embedded software which primarily governs the
functioning of embedded systems.
During infancy years of microprocessor based systems, programs were developed using
assemblers and fused into the EPROMs. There used to be no mechanism to find what the
program was doing. LEDs, switches, etc. were used to check correct execution of the
program. Some ‘very fortunate’ developers had In-circuit Simulators (ICEs), but they were
too costly and were not quite reliable as well.
As time progressed, use of microprocessor-specific assembly-only as the programming
language reduced and embedded systems moved onto C as the embedded programming
language of choice. C is the most widely used programming language for embedded
processors/controllers. Assembly is also used but mainly to implement those portions of the
code where very high timing accuracy, code size efficiency, etc. are prime requirements.
Initially C was developed by Kernighan and Ritchie to fit into the space of 8K and to write
(portable) operating systems. Originally it was implemented on UNIX operating systems. As
it was intended for operating systems development, it can manipulate memory addresses.
Also, it allowed programmers to write very compact codes. This has given it the reputation as
the language of choice for hackers too.
M.M.E.C. Mullana Page 10
Advance Real Time Embedded Systems
As assembly language programs are specific to a processor, assembly language didn’t offer
portability across systems. To overcome this disadvantage, several high level languages,
including C, came up. Some other languages like PLM, Modula-2, Pascal, etc. also came but
couldn’t find wide acceptance. Amongst those, C got wide acceptance for not only embedded
systems, but also for desktop applications. Even though C might have lost its sheen as
mainstream language for general purpose applications, it still is having a strong-hold in
embedded programming. Due to the wide acceptance of C in the embedded systems,
various kinds of support tools like compilers & cross-compilers, ICE, etc. came up and all
this facilitated development of embedded systems using C.
2.1 Variety of embedded systems :
Embedded systems are widespread in consumer, industrial, commercial and military
applications.
Telecommunications systems employ numerous embedded systems from telephone
switches for the network to mobile phones at the end-user. Computer networking uses
dedicated routers and network bridges to route data.
Consumer electronics include personal digital assistants (PDAs), mp3 players, mobile
phones, videogame consoles, digital cameras, DVD players, GPS receivers, and printers.
Many household appliances, such as microwave ovens, washing machines and dishwashers,
include embedded systems to provide flexibility, efficiency and features.
Advanced HVAC systems use networked thermostats to more accurately and efficiently
control temperature that can change by time of day and season. Home automation uses wired-
and wireless-networking that can be used to control lights, climate, security, audio/visual,
surveillance, etc., all of which use embedded devices for sensing and controlling.
Transportation systems from flight to automobiles increasingly use embedded systems. New
airplanes contain advanced avionics such as inertial guidance systems and GPS receivers that
also have considerable safety requirements. Various electric motors — brushless DC
motors, induction motors and DC motors — use electric/electronic motor
controllers. Automobiles, electric vehicles, and hybrid vehicles increasingly use embedded
systems to maximize efficiency and reduce pollution. Other automotive safety systems
include anti-lock braking system (ABS), Electronic Stability Control (ESC/ESP), traction
control (TCS) and automatic four-wheel drive.
M.M.E.C. Mullana Page 11
Advance Real Time Embedded Systems
2.2 CHARACTERISTICS:
1. Embedded systems are designed to do some specific task, rather than be a general-purpose
computer for multiple tasks. Some also have real-time performance constraints that must be
met, for reasons such as safety and usability; others may have low or no performance
requirements, allowing the system hardware to be simplified to reduce costs.
2. Embedded systems are not always standalone devices. Many embedded systems consist of
small, scomputerized parts within a larger device that serves a more general purpose. For
example, the Gibson Robot Guitar features an embedded system for tuning the strings, but the
overall purpose of the Robot Guitar is, of course, to play music. [5] Similarly, an embedded
system in an automobile provides a specific function as a subsystem of the car itself.
3. The program instructions written for embedded systems are referred to as firmware, and
are stored in read-only memory or Flash memory chips. They run with limited computer
hardware resources: little memory, small or non-existent keyboard or screen.
2.3 User interface
Embedded systems range from no user interface at all — dedicated only to one task — to
complex graphical user interfaces that resemble modern computer desktop operating systems.
Simple embedded devices use buttons, LEDs, graphic or character LCDs (for example
popular HD44780 LCD) with a simple menu system.
More sophisticated devices which use a graphical screen with touch sensing or screen-edge
buttons provide flexibility while minimizing space used: the meaning of the buttons can
change with the screen, and selection involves the natural behavior of pointing at what's
desired. Handheld systems often have a screen with a "joystick button" for a pointing device.
2.4 Processors in embedded systems
Embedded processors can be broken into two broad categories. Ordinary microprocessors
(μP) use separate integrated circuits for memory and peripherals. Microcontrollers (μC) have
many more peripherals on chip, reducing power consumption, size and cost. In contrast to the
personal computer market, many different basic CPU architectures are used, since software is
custom-developed for an application and is not a commodity product installed by the end
user. Both Von Neumannas well as various degrees of Harvard architectures are
used. RISC as well as non-RISC processors are found. Word lengths vary from 4-bit to 64-
bits and beyond, although the most typical remain 8/16-bit. Most architectures come in a
M.M.E.C. Mullana Page 12
Advance Real Time Embedded Systems
large number of different variants and shapes, many of which are also manufactured by
several different companies.
2.5 Reliability
Embedded systems often reside in machines that are expected to run continuously for years
without errors, and in some cases recover by themselves if an error occurs. Therefore the
software is usually developed and tested more carefully than that for personal computers, and
unreliable mechanical moving parts such as disk drives, switches or buttons are avoided.
Specific reliability issues may include:
The system cannot safely be shut down for repair, or it is too inaccessible to repair.
Examples include space systems, undersea cables, navigational beacons, bore-hole
systems, and automobiles.
The system must be kept running for safety reasons. "Limp modes" are less tolerable.
Often backups are selected by an operator. Examples include aircraft navigation, reactor
control systems, safety-critical chemical factory controls, train signals.
The system will lose large amounts of money when shut down: Telephone switches,
factory controls, bridge and elevator controls, funds transfer and market making,
automated sales and service.
A variety of techniques are used, sometimes in combination, to recover from errors—both
software bugs such as memory leaks, and also soft errors in the hardware:
watchdog timer that resets the computer unless the software periodically notifies the
watchdog
subsystems with redundant spares that can be switched over to
software "limp modes" that provide partial function
Designing with a Trusted Computing Base (TCB) architecture[7] ensures a highly secure
& reliable system environment
An Embedded Hypervisor is able to provide secure encapsulation for any subsystem
component, so that a compromised software component cannot interfere with other
subsystems, or privileged-level system software. This encapsulation keeps faults from
propagating from one subsystem to another, improving reliability. This may also allow a
subsystem to be automatically shut down and restarted on fault detection.
Immunity Aware Programming
M.M.E.C. Mullana Page 13
Advance Real Time Embedded Systems
2.6 Peripherals
Embedded Systems talk with the outside world via peripherals, such as:
Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485 etc.
Synchronous Serial Communication Interface: I2C, SPI, SSC and ESSI (Enhanced
Synchronous Serial Interface)
Universal Serial Bus (USB)
Multi Media Cards (SD Cards, Compact Flash etc.)
Networks: Ethernet, LonWorks, etc.
Fieldbuses: CAN-Bus, LIN-Bus, PROFIBUS, etc.
Timers: PLL(s), Capture/Compare and Time Processing Units
Discrete IO: aka General Purpose Input/Output (GPIO)
Analog to Digital/Digital to Analog (ADC/DAC)
Debugging: JTAG, ISP, ICSP, BDM Port, BITP, and DP9 ports.
2.7 Tools
As with other software, embedded system designers use compilers, assemblers,
and debuggers to develop embedded system software. However, they may also use some
more specific tools:
In circuit debuggers or emulators (see next section).
Utilities to add a checksum or CRC to a program, so the embedded system can check if
the program is valid.
For systems using digital signal processing, developers may use a math workbench such
as Scilab / Scicos, MATLAB / Simulink, EICASLAB, MathCad, Mathematica,or FlowSt
M.M.E.C. Mullana Page 14
Advance Real Time Embedded Systems
one DSP to simulate the mathematics. They might also use libraries for both the host and
target which eliminates developing DSP routines as done in DSPnano RTOS and Unison
Operating System.
A model based development tool like VisSim lets you create and simulate graphical data
flow and UML State chart diagrams of components like digital filters, motor controllers,
communication protocol decoding and multi-rate tasks. Interrupt handlers can also be
created graphically. After simulation, you can automatically generate C-code to
the VisSim RTOS which handles the main control task andpreemption of background
tasks, as well as automatic setup and programming of on-chip peripherals.
Custom compilers and linkers may be used to optimize specialized hardware.
An embedded system may have its own special language or design tool, or add
enhancements to an existing language such as Forth or Basic.
Another alternative is to add a real-time operating system or embedded operating system,
which may have DSP capabilities like DSPnano RTOS.
Modeling and code generating tools often based on state machines
Software tools can come from several sources:
Software companies that specialize in the embedded market
Ported from the GNU software development tools
Sometimes, development tools for a personal computer can be used if the embedded
processor is a close relative to a common PC processor
PROJECT ON: To display alphabets on LCD with AVR microcontroller(ATmega16)
using persistence of vision
LETTER A
M.M.E.C. Mullana Page 15
Advance Real Time Embedded Systems
#include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={1,2,4,8,16,48,80,144,80,48,16,8,4,2,1},i;while(1){for( i=0;i<14 ;i++){PORTC=~a[i];_delay_ms(3);}}}
LETTER B
#include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,145,145,145,255},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(3);}
}}
LETTER C
#include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,129,129,129,129},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER D
#include<avr/io.h>#include<util/delay.h>void main()
M.M.E.C. Mullana Page 16
Advance Real Time Embedded Systems
{DDRC=0xff;char a[]={255,129,129,129,129,255},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER E #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,145,145,145,145},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(5);}}}
LETTER F #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,144,144,144,144,144,144,144,144,144,144,144,144},i;while(1){for( i=0;i<13 ;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER G #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,129,129,129,4,2,1,133,133,133,4,2,1},i;while(1){
M.M.E.C. Mullana Page 17
Advance Real Time Embedded Systems
for( i=0;i<13;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER H #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,32,32,32,32,255},i;while(1){for( i=0;i<6;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER I #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={129,129,129,255,129,129,129},i;while(1){for( i=0;i<8;i++){PORTC=~a[i];_delay_ms(5);}
}}LETTER J #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={136,129,129,129,255,128,128,128},i;while(1){for( i=0;i<8;i++){PORTC=~a[i];_delay_ms(5);}
M.M.E.C. Mullana Page 18
Advance Real Time Embedded Systems
}}
LETTER K #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,24,36,66,129},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER L #include<avr/io.h>#include<util/delay.h>void main(){int i;char a[]={1,2,4,8,16,32,64,128,1,1,1,1,1,1,1};DDRC=0XFF;while(1){for(i=0;i<15;i++){PORTC=~a[i];_delay_ms(2);}
}}LETTER M #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={1,2,4,8,16,32,64,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,64,32,16,8,4,2,1},i;while(1){for( i=0;i<30 ;i++){PORTC=~a[i];_delay_ms(5);}
M.M.E.C. Mullana Page 19
Advance Real Time Embedded Systems
}}
LETTER N #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={1,2,4,8,16,32,64,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128},i;while(1){for( i=0;i<23 ;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER O
#include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,129,129,129,129,255},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(5);}
}}LETTER P #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,144,144,144,240},i;while(1){for( i=0;i<5 ;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER Q
M.M.E.C. Mullana Page 20
Advance Real Time Embedded Systems
#include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,129,129,133,131,255},i;while(1){for( i=0;i<6;i++){PORTC=~a[i];_delay_ms(5);}
}}
LETTER R #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,152,148,146,225},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(5);}
}}LETTER S #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={241,0,0,145,0,0,145,0,0,145,0,0,159},i;while(1){for( i=0;i<13;i++){PORTC=~a[i];_delay_ms(3);}}}
LETTER T #include<avr/io.h>#include<util/delay.h>void main()
M.M.E.C. Mullana Page 21
Advance Real Time Embedded Systems
{DDRC=0xff;char a[]={129,129,129,255},i;while(1){for( i=0;i<4;i++){PORTC=~a[i];_delay_ms(3);}
}}
LETTER U #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={255,1,1,1,1,255},i;while(1){for( i=0;i<5;i++){PORTC=~a[i];_delay_ms(3);}
}}
LETTER V #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={1,2,4,8,16,32,64,128,64,32,16,8,4,2,1},i;while(1){for( i=0;i<15 ;i++){PORTC=~a[i];_delay_ms(3);}
}}
LETTER W #include<avr/io.h>#include<util/delay.h>void main()
M.M.E.C. Mullana Page 22
Advance Real Time Embedded Systems
{DDRC=0xff;char a[]={255,2,4,8,16,8,4,2,255},i;while(1){for( i=0;i<9;i++){PORTC=~a[i];_delay_ms(3);}
}}
LETTER X #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={130,68,40,16,40,68,130},i;while(1){for( i=0;i<7;i++){PORTC=~a[i];_delay_ms(3);}
}} LETTER Y #include<avr/io.h>#include<util/delay.h>void main(){DDRC=0xff;char a[]={128,64,32,16,255},i;while(1){for( i=0;i<9;i++){PORTC=~a[i];_delay_ms(3);}
}}
LETTER Z #include<avr/io.h>#include<util/delay.h>
M.M.E.C. Mullana Page 23
Advance Real Time Embedded Systems
void main(){DDRC=0xff;char a[]={129,131,133,137,145,161,193,129},i;while(1){for( i=0;i<8;i++){PORTC=~a[i];_delay_ms(3);}
}}
4.0 Important Terms used in Project :
4.1 ATMEL (AVR):
The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which
was developed by Atmel in 1996. The AVR was one of the first microcontroller families to
use on-chip flash memory for program storage, as opposed to one-time programmable
ROM, EPROM, or EEPROM used by other microcontrollers at the time.
4.1.1 Brief History:
The AVR architecture was conceived by two students at the Norwegian Institute of
Technology (NTH) Alf-Egil Bogen and Vegard Wollan.
The original AVR MCU was developed at a local ASIC house in Trondheim, Norway called
Nordic VLSI at the time, now Nordic Semiconductor, where Bogen and Wollan were
working as students.It was known as a μRISC (Micro RISC) and was available as silicon
IP/building block from Nordic VLSI. When the technology was sold to Atmel from Nordic
VLSI, the internal architecture was further developed by Bogen and Wollan at Atmel
Norway, a subsidiary of Atmel. The designers worked closely with compiler writers at IAR
Systems to ensure that the instruction set provided for more efficient compilation of high-
level languages Atmel says that the name AVR is not an acronym and does not stand for
anything in particular. The creators of the AVR give no definitive answer as to what the term
"AVR" stands for.However, it is commonly accepted that AVR stands for Alf (Egil Bogen)
and Vegard (Wollan)'s Risc processor.
Note that the use of "AVR" in this article generally refers to the 8-bit RISC line of Atmel
AVR Microcontrollers.
M.M.E.C. Mullana Page 24
Advance Real Time Embedded Systems
4.1.2 Basic families:
AVRs are generally classified into six broad groups:
TinyAVR — the ATtiny series
0.5–16 kB program memory
6–32-pin package
Limited peripheral set
Current lineup
MegaAVR — the ATmega series
4–512 kB program memory
28–100-pin package
Extended instruction set (Multiply instructions and instructions for handling larger
program memories)
Extensive peripheral set
XMEGA — the ATxmega series
16–384 kB program memory
44–64–100-pin package (A4, A3, A1)
Extended performance features, such as DMA, "Event System", and cryptography
support.
Extensive peripheral set with DACs
Application-specific AVR
megaAVRs with special features not found on the other members of the AVR family,
such as LCD controller, USB controller, advanced PWM, CAN, etc.
FPSLIC (AVR with FPGA)
FPGA 5K to 40K gates
SRAM for the AVR program code, unlike all other AVRs
AVR core can run at up to 50 MHz
32-bit AVRs
AVR32
M.M.E.C. Mullana Page 25
Advance Real Time Embedded Systems
In 2006 Atmel released microcontrollers based on the new, 32-
bit, AVR32 architecture. They include SIMD and DSP instructions, along with other
audio and video processing features. This 32-bit family of devices is intended to
compete with the ARM based processors. The instruction set is similar to other RISC
cores, but is not compatible with the original AVR or any of the various ARM cores.
4.2 UART
A Universal Asynchronous Receiver/Transmitter, abbreviated UART, is a type of
"asynchronous receiver/transmitter", a piece of computer hardware that translates data
between parallel and serial forms. UARTs are commonly used in conjunction with
communication standards such as EIA, RS-232, RS-422 or RS-485. The universal
designation indicates that the data format and transmission speeds are configurable and that
the actual electric signaling levels and methods (such as differential signaling etc.) typically
are handled by a special driver circuit external to the UART.
A UART is usually an individual (or part of an) integrated circuit used for serial
communications over a computer or peripheral device serial port. UARTs are now commonly
included in microcontrollers. A dual UART, or DUART, combines two UARTs into a single
chip. Many modern ICs now come with a UART that can also communicate synchronously;
these devices are called USARTs (universal synchronous/asynchronous receiver/transmitter).
4.2.1 Transmitting and Receiving serial data
Asynchronous serial communication
The Universal Asynchronous Receiver/Transmitter (UART) takes bytes of data and transmits
the individual bits in a sequential fashion. At the destination, a second UART re-assembles
the bits into complete bytes. Each UART contains a shift register, which is the fundamental
method of conversion between serial and parallel forms. Serial transmission of digital
information (bits) through a single wire or other medium is much more cost effective than
parallel transmission through multiple wires.
M.M.E.C. Mullana Page 26
Advance Real Time Embedded Systems
The UART usually does not directly generate or receive the external signals used between
different items of equipment. Separate interface devices are used to convert the logic level
signals of the UART to and from the external signaling levels. External signals may be of
many different forms. Examples of standards for voltage signaling are RS-232, RS-422 and
RS-485 from the EIA. Historically, current (in current loops) was used in telegraph circuits
Receiver:
All operations of the UART hardware are controlled by a clock signal which runs at a
multiple of the data rate. For example, each data bit may be as long as 16 clock pulses. The
receiver tests the state of the incoming signal on each clock pulse, looking for the beginning
of the start bit. If the apparent start bit lasts at least one-half of the bit time, it is valid and
signals the start of a new character. If not, the spurious pulse is ignored. After waiting a
further bit time, the state of the line is again sampled and the resulting level clocked into a
shift register. After the required number of bit periods for the character length (5 to 8 bits,
typically) have elapsed, the contents of the shift register is made available (in parallel
fashion) to the receiving system. The UART will set a flag indicating new data is available,
and may also generate a processor interrupt to request that the host processor transfers the
received data.
Transmitter:
Transmission operation is simpler since it is under the control of the transmitting system. As
soon as data is deposited in the shift register after completion of the previous character, the
UART hardware generates a start bit, shifts the required number of data bits out to the line,
generates and appends the parity bit (if used), and appends the stop bits. Since transmission
of a single character may take a long time relative to CPU speeds, the UART will maintain a
flag showing busy status so that the host system does not deposit a new character for
transmission until the previous one has been completed; this may also be done with an
interrupt. Since full-duplex operation requires characters to be sent and received at the same
time, practical UARTs use two different shift register
Structure:
A UART usually contains the following components:
M.M.E.C. Mullana Page 27
Advance Real Time Embedded Systems
a clock generator, usually a multiple of the bit rate to allow sampling in the middle of
a bit period.
input and output shift registers
transmit/receive control
read/write control logic
transmit/receive buffers (optional)
parallel data bus buffer (optional)
First-in, first-out (FIFO) buffer memory (optional)
M.M.E.C. Mullana Page 28
Advance Real Time Embedded Systems
5.0 CONCLUSION
It was realy a great experience to work in the embedded field, one may come to know about various applications used in almost every field of life.8051 is only 8 bit controller, but still not obsolete and used in various applications as like these
1. This can be used in banks for securing the lockers.
2. In computers to avoid the misuse of the system by interloper.
3. In home security to avoid theft.
4. In mobile security, to avoid access by foreigners
16 bit, 32 bits controller has also developed and presently used by industries world wile, but8051 also has its importance and still using for such applications.
.
M.M.E.C. Mullana Page 29
Advance Real Time Embedded Systems
6.0 BIBLIOGRAPHY
The following books are being used to fulfil the requirements of the proposed
project and are helpful in the understanding, development and the maintenance
of the project:
Embedded C by NIIT
Websites Visited:
www.google.com/products/jmf
www.wikipedia.com
M.M.E.C. Mullana Page 30