Upload
urvashi-khandelwal
View
344
Download
4
Embed Size (px)
Citation preview
SOFCON TRAINING PRESENTATION
Embedded system Report By: URVASHI KHANDELWAL
CONTENT• Embedded system Introduction Applications• AVR microcontroller Introduction Features PIN and port Description Embedded C Hardware Interfacing and Coding
DEPARTMENT OF EMBEDDED SYSTEM• An Embedded system is a combination of computer hardware and software which is designed to perform
many operations such as to access the data, process the data, store the data and also control the data in electronics based systems. In embedded systems, software commonly known as firmware Basically embedded systems are task specific devices
• Embedded system is defined as a way of working, organizing, performing single or multiple tasks according to a set of rules
• Hence it covers all the industries like
- BIOTECHNOLOGY
-TELECOME
- MILTARY
- AUTOMOBIEL
- CONSUMER ELECTRONICS
APPLICATION
AVR (ADVANCED VIRTUAL RISC) ATMEGA 8
MICRO-CONTROLLER
INTRODUCTION
• ATmega8 is a 8-bit microcontroller based on the AVR RISC architecture
• By executing powerful instructions in a single clock cycle, the ATmega8 achieves throughput approaching 1 MIPS per MHz
• Instruction in program memory are executed with single level pipelining
• This concept enables instructions to be executed in every clock cycle
FEATURES
• High-performance 8 bit Microcontroller• 32 x 8 General Purpose Working Registers• Six ADC channels in PDIP package• Internal Calibrated Oscillator
MEMORY SEGMENTS
• 8K Bytes of Flash program memory• 512 Bytes EEPROM (Electrically Erasable Programmable Read
Only Memory)• 1K Byte Internal RAM (Random Access Memory)• Write/Erase Cycles: 10,000 Flash/100,000 EEPROM• Data retention: 20 years at 85°C/100 years at 25°C
TYPES OF PACKAGES
• 28-pin PDIP (Plastic Dual In-line Package)opaque molded plastic pressed around a tin-,silver-, or gold-plated lead frame that supports the device die and provides connection pins.
• 32-pin TQFP (Thin Quad film Package) For easy soldering
PIN OUTPLASTIC DUAL IN-LINE PACKAGE
PIN DESCRIPTION
• VCC Digital supply voltage• GND Ground• RESET A low level on this pin for longer than the minimum
pulse length will generate a reset, even if the clock is not running
• AREF The analog reference pin for the A/D Converter• AVCC The supply voltage pin for the A/D Converter
• Three ports i.e PortB, PortC, PortD -General Purpose 8 Bit bidirectional I/O
• Three registers associated with every portDDRx – Data Direction RegisterPINx – Port inputPORTx- Port output
*Note – ‘x’ is subscript and could be either of B, C, D
PORTS
PORT B (PB7..PB0)
• Port B is an 8-bit bi-directional I/O port
• Can be used either as a input port or as output port ( direction must be specified in programming)
REGISTER DESCRIPTION OF I/O PORTS
USING EMBEDDED C• Embedded C is nothing but a subset of C language which is
compatible with certain microcontrollers.• Some features are added using header files like <avr/io.h>,
<util/delay.h>.• scanf() and printf() are removed as the inputs are scanned
from the sensors and outputs are given to the ports.• Control structures remain the same like if-statement, for loop,
do-while etc.
Programming Microcontroller
SOFTWARE’S USED:
AVR STUDIO 4.0
AVR studio is an Integrated Development Environment (IDE) by ATMEL for
developing applications based on 8-bit AVR microcontroller
PROTEUS 7 DESIGN SUITE
• this software helps programmers in hardware implementations.
• It provides a huge number of electronic components and
• REAL TIME ANOMATONS of the hardware designs.
• This is the perfect tool for engineers to test their microcontroller designs Before constructing a physical
prototype in real time
HOW TO WORK AT AVR STUDIO
Step1. Start AVR Studio on your workstation. Select "New Project". Type is "AVR-GCC". Project name: "MyFirstProject". Check off the "create folder" box. Modify the location if desired.Step2. Click "Next".
1. Start AVR Studio on your workstation. Select "New Project". Type is "AVR-GCC". Project name: "MyFirstProject". Check off the "create folder" box. Modify the location if desired.
CONTD…
Step3. Debug platform should be "AVR Simulator". Device Is "ATMEGA 8".Step4. Click Finish. You will now be in the IDE.
CONTD…
CONTD…
.
Step5.Write the following code into the window in the middle of the screen (the window for My FirstProject.c):This is a quick and dirty way to turn both LEDs on.This code tells all of Port B to become outputs by writing 0xFF (binary 1111 1111) to DDRB which is the data direction register for port B.
Step 6.Compile the code with "Build -> Build" from the menu, or the F7 shortcut for "Build". The bottom window will show the progress and results. You should see "Build succeeded with 0 warnings.If there is an error, check your code for typos. The error message should give you the offending line numberA successful compile will result in a .hex file being generated. This is the binary code in a format ready to be burned into your AVR chip by the programmer. (Think of the .hex file as a program that the target AVR chip can run once we put it on there, sort of like writing to a memory card.)You should be able to locate MyFirstProject.hex in your project dir. For me, it was in "AVR\src\MyFirstProject\default\".
CONTD….
Step 7. Now let's debug the code in the simulator to get a feel for how it works.Use "Build -> Build and Run" from the menu, or use the CTRL-F7 shortcut.Note the following:We have a yellow arrow at the current execution.We have some debugging keys at the top (we want STOP and STEP INTO now).We have "AVR SIMULATOR" at the bottom which is no longer greyed out.Now click on the right pane on PORTB so we can look at it in the "I/O View". The bottom right window will populate with DDRB, PINB, and PORTB. These represent some states of the simulator's virtual ATTINY45 hardware.
CONTD…
Step 8. Step through the program line by line with "STEP INTO (F11)" button.Notice DDRB (direction of pins for PORTB: input or output) changes on the bottom right after "DDRB = 0xff" is executed.Step 9. Step again and notice that PORTB becomes set to 0xff (all logical 1 output) when "PORTB = 0xff" is executed.We are now at the end of the program. Click "STOP DEBUGGING" (the blue square button on the menu bar ) or CTRL-SHIFT-F5 to stop the debugger and chip simulator and return to the coding view.
SOME EXAMPLES USING EMBEDDED C1. Blinking of even no. lights at port
HARDWARE INTERFACING'S AND CODING:
Seven Segment Interfacing with Microcontroller
LCD interfacing with Microcontroller
7 SEGMENT DISPLAY
CONTD…
LCD(4-BITS) INTERFACING
PB0/ICP114
PB1/OC1A15
PB2/SS/OC1B16
PB3/MOSI/OC217
PB4/MISO18
PB5/SCK19
PB6/TOSC1/XTAL19
PB7/TOSC2/XTAL210 PC6/RESET 1
PD0/RXD 2
PD1/TXD 3
PD2/INT0 4
PD3/INT1 5
PD4/T0/XCK 6
PD5/T1 11
PD6/AIN0 12
PD7/AIN1 13
PC0/ADC0 23
PC1/ADC1 24
PC2/ADC2 25
PC3/ADC3 26
PC4/ADC4/SDA 27
PC5/ADC5/SCL 28
AREF21
AVCC20
U1
ATMEGA8
D714
D613
D512
D411
D310
D29
D18
D07
E6
RW5
RS4
VSS
1
VDD
2
VEE
3
LCD1LM016L
LCD(8-BITS) INTERFACING
D714
D613
D512
D411
D310
D29
D18
D07
E6
RW5
RS4
VSS
1
VDD
2
VEE
3
LCD1LM016L
PB0/ICP114
PB1/OC1A15
PB2/SS/OC1B16
PB3/MOSI/OC217
PB4/MISO18
PB5/SCK19
PB6/TOSC1/XTAL19
PB7/TOSC2/XTAL210 PC6/RESET 1
PD0/RXD 2
PD1/TXD 3
PD2/INT0 4
PD3/INT1 5
PD4/T0/XCK 6
PD5/T1 11
PD6/AIN0 12
PD7/AIN1 13
PC0/ADC0 23
PC1/ADC1 24
PC2/ADC2 25
PC3/ADC3 26
PC4/ADC4/SDA 27
PC5/ADC5/SCL 28
AREF21
AVCC20
U1
ATMEGA8
THANK YOU…