Summer Training Report On Embedded System (Atishay Kumar)
Summer Training Report On Embedded System (Atishay Kumar)
Training Report
Of
On
EMBEDDED SYSTEM
Submitted
Diploma
2018-2019
ATISHAY KUMAR
DIPLOMA, BATCH 2017-2018
ROLL NO:-1704081011
ELECTRONICS & COMMUNICATION ENGINNERING
GURU NANAK DEV INSTITUTE OF TECHNOLOGY
NCT OF DELHI
2
ACKNOWLEDGEMENT
I am deeply thankful to “WebTek Labs” as it has given me golden opportunity
to go through remarkable training on “Embedded System”. Here I have got
valuable and detailed knowledge on real time Projects. I owe my gratitude to
My Faculty cum Trainer “Mr. Mangat Ram ” for his unmatched support
guidance and inspiration without which I would not have learned so many new
&innovative things in such a short span of time.
Your’s Faithfully.
Atishay Kumar
3
PREFACE
Practical exposure in the field of embedded system is extremely important as it
gives a close view of the real electronic world issues. It helps to cover all parts
that remained uncovered in the classroom. It helps gain experience. Just
theoretical knowledge is not sufficient for the success of any engineer student.
So one should have practical knowledge about each theory of life.
I learnt lot of new things from this training, which could never have been learnt
from theory classes.
If any findings & recommendations go in any way to prove some new ground in
helping the commodity future sector, I shall deem my efforts have dully served
the purpose. In the forth coming pages an attempt has been made to present
report covering different aspects of my trainings.
4
TABLE OF CONTENT
S.NO. Content Page No.
1 Embedded Systems 07
5 What is a Microcontroller? 11
8 AVR MICROCONTROLLER 13
10 Introduction to Atmega16 14
11 Atmega16 Pinout 16
13 Applications 19
14 Features 20
17 7-segment Display 28
26 16*2 LCD 36
31 Conclusion 47
6
1. Embedded Systems
1.1 Introduction:-
Embedded Systems are inseparable part of our life. Whether we are
at home or office or on the move, we are always surrounded by embedded
systems. Starting from home appliances like TV, washing machine and systems
like printer and elevator in workplace to the automobiles and automatic traffic
control system are all examples of embedded systems. All kinds of magazines
and journals regularly dish out details about latest technologies, new devices;
fast applications which make us believe that our basic survival is controlled by
these embedded products.
Hardware
Software
7
1.2 Characteristics of embedded products:-
1. They perform a single set of functions.
2. Works in a time constrained environment.
3. Provide high performance and reliability.
4. Mostly Embedded systems have low cost because they are mass
produced in millions.
2. Automotive applications
Braking systems, traction systems, airbag release systems, engine-
management units, steer-by-wire systems, cruise control applications
3. Domestic appliances
Dishwashers, televisions, washing machines microwave ovens, Video
recorders, security systems, garage door controllers, calculators, digital
watches, VCRs, Digital cameras, Remote controls, Treadmills.
4. Robotic
Fire fighting robots, Automatic floor cleaner, robotic arm etc.
5. Aerospace applications
Flight control systems, engine controllers, autopilots, passenger in-flight
entertainment systems.
6. Medical equipment
An aesthesia monitoring systems, ECG monitors, Pacemakers, Drug
delivery systems, MRI scanners
7. Defense systems
Radar systems, fighter aircraft flight control systems, radio systems,
missile guidance systems
8. Office automation
Laser printers, fax machines, pagers, cash registers, gas pumps,
credit/debit card readers, thermostats, grain analyzers
8
Difference Between Microcontroller And Microprocessor
Microcontroller
It’s like a small computer on a single IC. It contains a processor core, ROM,
RAM and I/O pins dedicated to perform various tasks. Microcontrollers are
generally used in projects and applications that require direct control of user. As
it has all the components needed in its single chip, it does not need any external
circuits to do its task so microcontrollers are heavily used in embedded systems
and major microcontroller manufacturing companies are making them to be
used in embedded market. A microcontroller can be called the heart of
embedded system. Some examples of popular microcontrollers are 8051, AVR,
PIC series of microcontrollers,.
9
Microprocessor
Microprocessor has only a CPU inside them in one or few Integrated Circuits.
Like microcontrollers it does not have RAM, ROM and other peripherals. They
are dependent on external circuits of peripherals to work. But microprocessors
are not made for specific task but they are required where tasks are complex and
tricky like development of software’s, games and other applications that require
high memory and where input and output are not defined. It may be called heart
of a computer system. Some examples of microprocessor are Pentium, I3, and
I5 etc.
10
What is a Microcontroller?
A microcontroller is a small, low-cost and self contained computer-on-a-chip
that can be used as an embedded system. A few microcontrollers may utilize
four-bit expressions and work at clock rate frequencies, which usually include:
An 8 or 16 bit microprocessor.
A little measure of RAM.
Programmable ROM and flash memory.
Parallel and serial I/O.
Timers and signal generators.
Analog to Digital and Digital to Analog conversion
RISC: The RISC is stands for Reduced Instruction set Computer, this type of
instruction sets reduces the design of microprocessor for industry standards. It
allows each instruction to operate on any register or use any addressing mode
and simultaneous access of program and data.
Loop Begin
12
AVR MICROCONTROLLER
13
megaAVR – the ATmega series
o 4–256 KB program memory
o 6-32-pin package
o Extended instruction set (multiply instructions and instructions for
handling larger program memories)
o Extensive peripheral set
o
XMEGA – the ATxmega series
o 16–384 KB program memory
o 44–100-pin package (A4, A3, A1)
o 32-pin package: XMEGA-E (XMEGA8E5)
o Extended performance features, such as DMA, "Event System", and
cryptography support
o Extensive peripheral set with ADCs
Introduction to Atmega16
14
external devices. It can take input by reading registers and give output by
writing registers.
Atmega16 comes with two 8-bit timers and one 16-bit timer. All these timers
can be used as counters when they are optimized to count the external signal.
15
Atmega16 Pinout
16
PORTC = 8 Pins ( Pin 22 – 29 )
PORTD = 8 Pins ( Pin 14 – 21 )
Following are the main functions associated with pins.
17
PORTC. PORTC is an I/O bidirectional port that consists of 8 pins. Pin from
22 to 29 belongs to this port. Similar to other ports, it comes with internal pull-
up resistors.
18
features associated with this port like interrupts, serial communication, timer,
and PWM.
Reset. Pin9 is an active low reset Pin. A low-level pulse for longer than
minimum pulse length will produce a reset. Short pulses are unlikely to produce
reset.
VCC. Pin10 is a power supply pin for this controller. The power supply of 5 V
is required to put this controller in a running condition.
AVCC. Pin30 is an AVCC which is a supply voltage pin for PORTA and ADC.
It is connected to VCC through a low pass filter in the presence of ADC.
However, in the absence of ADC, AVCC is externally connected to VCC.
Pin 12 & 13. A crystal oscillator is connected with these pins. Atmega16 works
at the internal frequency of 1MHZ; the oscillator is added to generate high clock
pulses and frequency.
19
Applications
AVR controllers come with a wide range of applications where automation is
required. Following are the main applications of Atmega16.
Medical equipment
Home automation
Embedded systems
Arduino Projects
Used in automobiles and industrial automation
Home appliances and security systems
Temperature and pressure control devices
Features
20
Peripheral Features
o Two 8-bit Timer/Counters with Separate Prescalers and
Compare Modes
o One 16-bit Timer/Counter with Separate Prescaler, Compare
Mode, and Capture Mode
o Real Time Counter with Separate Oscillator
o Four PWM Channels
o 8-channel, 10-bit ADC
o 8 Single-ended Channels
o Byte-oriented Two-wire Serial Interface
o Programmable Serial USART
o Master/Slave SPI Serial Interface
o Programmable Watchdog Timer with Separate On-chip
Oscillator
o On-chip Analog Comparator
I/O and Packages
o 32 Programmable I/O Lines
o 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
Operating Voltages
o 7V – 5.5V for ATmega16L
o 5V – 5.5V for ATmega16
Speed Grades
o 0 – 8 MHz for ATmega16L
o 0 – 16 MHz for ATmega16
Power Consumption @ 1 MHz, 3V, and 25°C for ATmega16L
o Active: 1.1 mA
o Idle Mode: 0.35 mA
o Power-down Mode: < 1 µA
21
Programming AVRs Using AVR Studio 4
Introduction
Atmel, AVR microcontrollers (MCUs) are very easy to use. All AVR
microcontrollers require Integrated Development Environment(IDE) such as
Atmel Studio. Using this IDE, we can create, compile and debug program on all
AVR microcontrollers.
Atmel Studio is available free of charge. To download and install latest Atmel
studio use this link.
Note: There are possibly two options for downloading and installing Atmel
Studio as online/offline. Atmel recommends for online web installer so use
online web installer if possible.
Here, we are using Atmel Studio 7 as currently latest IDE for developing
program of Atmega16 microcontroller.
Atmel Studio 7 includes the GCC C and C++ compiler, assembler and a
simulator, and interfaces seamlessly with in-system debuggers and
programmers to make code development easier.
Let’s develop simple LED Blinking program for ATmega16 using Atmel Studio
7
1. After done with downloading and installing, Open Atmel Studio 7. We can
see Start Page as shown in below figure.
22
2. Now to create new project Click on File -> New -> Project or simply
use Ctrl+Shift+N Short keys.
23
4. After click on OK, Device Selection window will pop up as shown in below
figure. In that we can directly type device name to get required device from
device list shown in below figure.
Click on device name and then click OK. Here we have selected ATmega16
microcontroller device.
5. Now wait till Atmel studio creates project and main.c file to write program
for selected device as shown in below figure.
24
6. Now write a program. Here we are writing program for LED Blinking
connected to a PORTB of ATmega16.
25
Program for led blinking
/*
* ATmega16_LED_Blinking.c
* http://www.electronicwings.com
* Created: Created Date & Created Time
* Author : Author Name
*/
int main(void)
{
DDRB = 0xFF; /* Make all pins of PORTB as output pins */
26
7. After writing program, save (Ctrl+S) the program and click on Build
Solution from Build menu as shown in below figure.
8. Now we can see build succeeded output in Output Window (lower left corner
of window) as shown in below figure.
27
D:\AtmelProjects\ATmega16_LED_Blinking\ATmega16_LED_Blinking\
Debug\ ATmega16_LED_Blinking.hex
10. Now upload this hex file to ATmega microcontroller. AVRDUDE is
program to burn hex code in to the Atmel AVR microcontroller.
SinaProg (find in attachment given below) is AVRDUDE GUI software, which
utilizes AVRDUDE program to burn hex code in to the Atmel AVR
microcontroller using USBasp.
USBasp is USB in circuit programmer for Atmel AVR controllers.
28
7-segment Display
An LED or Light Emitting Diode, is a solid state optical pn-junction diode
which emits light energy in the form of photons.
29
7-Segment Display Segments for all Numbers.
Then for a 7-segment display, we can produce a truth table giving the individual
segments that need to be illuminated in order to produce the required decimal
digit from 0 through 9 as shown below.
Decimal
Digit
a b c d e f g
0 × × × × × ×
1 × ×
2 × × × × ×
3 × × × × ×
4 × × × ×
5 × × × × ×
30
6 × × × × × ×
7 × × ×
8 × × × × × × ×
9 × × × × ×
31
Program for 7-Segment Display
#include<avr/io.h>
#define F_CPU 16000000UL
#include<util/delay.h>
void main()
{
DDRB=0b11111111;
PORTB=0b11000000;
_delay_ms(1000);
PORTB=0b11111001;
}
After 1 Second
32
About 8×8 LED Matrix
With low-voltage scanning, 8×8 LED Matrix LED display have advantages
such as power saving, long service life, low cost, high brightness, a wide angle
of view, long visual range, waterproofness,
and so on. They can meet the needs of different applications and thus have a
broad development prospect.
8×8 matrix consists of 64 dots or pixels. There is a LED for each pixel and these
LEDs are connected to total of 16 pins.
Generally, there are two types of dot matrix – common cathode and common
anode. They look almost the same in appearance. But usually there will be
labels for easy recognition. The one with a label ending with AX is a common
cathode dot matrix and that with BXis a common anode one. See the figure
below for how they look like. So the pins are distributed at the two ends of the
matrix. Pins at one end (usually the label side) are 1-8 from left to right, when at
the opposite they are 9-16 from right to left.
33
Program for patern (A) Printing on led matrix
#include<avr/io.h>
#define F_CPU 16000000UL
#include<util/delay.h>
void main()
{
while(1)
{
DDRA=DDRB=0XFF;
PORTA=0X01;
PORTB=0xe7;
_delay_ms(1);
PORTA=0X02;
PORTB=0xc3;
_delay_ms(1);
PORTA=0X04;
PORTB=0x99;
_delay_ms(1);
PORTA=0X08;
PORTB=0x3c;
_delay_ms(1);
PORTA=0X10;
PORTB=0X3c;
_delay_ms(1);
PORTA=0X20;
PORTB=0x3c;
_delay_ms(1);
PORTA=0X40;
PORTB=0x3c;
_delay_ms(1);
PORTA=0X80;
PORTB=0x3c;
_delay_ms(1);
PORTA=0X80;
PORTB=0x3c;
}
}
34
35
16*2 LCD
We come across LCD displays everywhere around us. Computers, calculators,
television sets, mobile phones, digital watches use some kind of display to
display the time. An LCD is an electronic display module which uses liquid
crystal to produce a visible image. The 16×2 LCD display is a very basic
module commonly used in DIYs and circuits. The 16×2 translates o a display 16
characters per line in 2 such lines. In this LCD each character is displayed in a
5×7 pixel matrix.
36
Pin
Name
No. Function
RS (Register
4 Selects command register when low, and data register when high
Select )
5 Low to write to the register; High to read from the register Read/write
Sends data to data pins when a high to low pulse is given; Extra voltage push
is required to execute the instruction and EN(enable) signal is used for this
6 purpose. Usually, we make it en=0 and when we want to execute the Enable
instruction we make it high en=1 for some milliseconds. After this we again
make it ground that is, en=0.
8 DB1
9 DB2
10 DB3
11 DB4
12 DB5
37
13 DB6
14 DB7
RS (Register select)
A 16X2 LCD has two registers, namely, command and data. The register select
is used to switch from one register to other. RS=0 for command register,
whereas RS=1 for data register.
Data Register: The data register stores the data to be displayed on the LCD.
The data is the ASCII value of the character to be displayed on the LCD. When
we send data to LCD it goes to the data register and is processed there. When
RS=1, data register is selected.
38
Important command codes for LCD
2 02 Return home
40
Programming for LCD16x2 with AVR ATmega16
Initialize LCD16x2: It is very easy to initialize a LCD16x2
When we give an enable pulse, the LCD latches the data present at D0 to D7,
and execute as command since RS is command reg.
42
_delay_ms(3);
}
When we give an enable pulse the LCD latches the data present (on the pins D0
to D7) and displays it on a 5x8 matrix, as RS is a data register.
Display String function
This function takes a string (an array of characters) and sends one
character at a time to the LCD data function till the end of the string. A ‘for
loop’ is used for sending a character in each iteration. A NULL character
indicates end of the string.
43
}
}
Note:
1. LCD Power-on delay: After the LCD16x2 powers ON, we cannot send
commands immediately to it since it needs self-initialization time of 15-
ms. Therefore, while programming, we need to take care of providing
sufficient power ON delay (> 15 ms), and then send command to the
LCD.
2. After proving commands, LCD16x2 takes time (in microseconds) to
execute it. But for 0x01 command (i.e. clear display), it takes 1.64-ms to
execute. Therefore, after sending 0x01 command sufficient delay (>
1.63milliseconds) needs to be provided.
LCD16x2 Program
#define F_CPU 8000000UL /* Define CPU Frequency e.g.
here 8MHz */
#include <avr/io.h> /* Include AVR std. library file */
#include <util/delay.h> /* Include inbuilt defined Delay header
file */
#define lcd PORTD /* Define LCD connected to port D */
44
LCD_Data_Port= cmnd;
LCD_Command_Port &= ~(1<<RS); /* RS=0 command reg. */
LCD_Command_Port &= ~(1<<RW); /* RW=0 Write operation */
LCD_Command_Port |= (1<<EN);/* Enable pulse */
_delay_us(1);
LCD_Command_Port &= ~(1<<EN);
_delay_ms(3);
}
void LCD_String_xy (char row, char pos, char *str)/* Send string to LCD with xy
position */
{
if (row == 0 && pos<16)
LCD_Command((pos & 0x0F)|0x80); /* Command of first row and
required position<16 */
else if (row == 1 && pos<16)
LCD_Command((pos & 0x0F)|0xC0); /* Command of first row and
required position<16 */
LCD_String(str); /* Call LCD string function */
}
void LCD_Clear()
{
LCD_Command (0x01); /* clear display */
LCD_Command (0x80); /* cursor at home position */
}
int main()
{
LCD_Init(); /* Initialize LCD */
46
LCD_String("ElectronicWINGS");/* write string on 1st line of LCD*/
LCD_Command(0xC0); /* Go to 2nd line*/
LCD_String("Hello World"); /* Write string on 2nd line*/
return 0;
}
OUTPUT
CONCLUSION
Introduction:
This part of the report describe the overall result and conclusion made during
the training report.
Lessons learned:
1 Basic of Embedded System
47
5 Introduction of various electronics component
Key Learning:
1 Enhancement in technical knowledge
3 Industrial Exposure
Knowledge Gained:
The training at WEBTEK Academy, Rajori Garden ,Delhi provided me an
insight on embedded system technology and recent trend in industry. This
training also helped me in my overall personality development by interaction
with many trainnes and the staff members. It provided me Industrial Exposure,
and the working experience with real life professionals which will certainly help
me in my career ahead.
Suitability of Organisation:
The organisation is suitable for any product based on an embedded system. The
whole staff is very cooperative. This organisation provides a healthy
environment for trinees that help them to develop a sense of professionalism in
realtion to job skills and performance.
48