This document discusses setting up an embedded system development environment for AVR microcontrollers using Eclipse. It provides steps to install AVR-GCC, the AVR toolchain, Eclipse, and the AVR Eclipse plugin. It then demonstrates creating a simple "Hello World" project in Eclipse that toggles LEDs connected to an AVR microcontroller. The document also discusses configuring the PATH and paths in Eclipse to allow projects to build properly.
6. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
install the avr-eclipse plugin.
This opens the screen to specify the plug-in to install.
Here you just enter the update URL of AVR-Eclipse
(http://avr-eclipse.sourceforge.net/updatesite/), press
enter and select the AVR Eclipse Plugin:
After you click Next you will be asked a lot of question, if you
accept licenses or if you trust unsigned software – to install
answer them all with yes. When the installation is finished Eclipse
wants to restart, you should do it.
6
21. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
GPIO / DIO / IO
GPIO is a digital Module, responsible on control all the PINS on the SOC
It is called
GPIO : General Purpose Input/Output
DIO : Directive input/Output
IO : input/Output
I will describe the GPIO on a General Concept and general Capabilities And Features.
Then will read the Atmega32 GPIO.
And on the future you will read the TivaC GPIO by yourself
21
44. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
ATMega32 Elementary I/O: LEDs
• LEDs must be connected the correct way round,
the diagram may be labeled a or + for anode and
k or - for cathode (yes, it really is k, not c, for
cathode!). The cathode is the short lead and
there may be a slight flat on the body of round
LEDs. If you can see inside the LED the cathode is
the larger electrode (but this is not an official
identification method).
• LEDs can be damaged by heat when soldering,
but the risk is small unless you are very slow. No
special precautions are needed for soldering
most LEDs.
• LEDs are available in red, orange, amber, yellow,
green, blue and white. Blue and white LEDs are
much more expensive than the other colors. The
color of an LED is determined by the
semiconductor material, not by the coloring of
the 'package' (the plastic body).
An LED is a semiconductor device that converts electrical energy directly into a
discrete color of light
44
45. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
ATMega32 Elementary I/O: LEDs
• Never connect an LED directly to a battery or power supply! It will be
destroyed almost instantly because too much current will pass through and
burn it out.
• LEDs must have a resistor in series to limit the current to a safe value, for quick
testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is
12V or less.
• The resistor value, R is given by:
• Estimate 1.5 - 2 V voltage drop (VL)
• Typically draws 10-20 mA (I)
Unless you know
what are you
doing!
45
57. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
DIO_Project1
Seven Segment Digital Clock So to eliminate this problem we will turn only one led on at a
time. Say at t=0m SEC, LED D1 is tuned ON. At t = 1m SEC, LED
D1 is tuned OFF and LED D2 is turned ON. Again at t=2 m SEC,
LED D2 is turned OFF and LED D1 is turned ON. This goes on.
Now the trick is, the human eye cannot capture a frequency
more than 30 HZ. That is if a LED goes ON and OFF
continuously at a rate of 30HZ or more. The eye sees the LED
as continuously ON. However this is not the case. The LED will
be constantly turning ON and OFF. This technique is called
multiplexing.
By using multiplexing, we will turn only one row at a time,
and there will be cycling around the 8 rows continuously. This
visualized as a completely turned ON matrix for a naked eye.
Multiplexing
With very speed
To render
Each row
57
72. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
I/O: 7-Segment Display
There are applications where you need to display a decimal
digit using a seven segment LED display.
The display could represent e.g. the number of times a
switch was pressed.
Digits 0-9 and hex A-F can be displayed by giving the
proper 7-segment codes
q g f e d c b a q g f e d c b a
0 0 1 1 1 1 1 1 8 1 1 1 1 1 1 1
1 0 0 0 0 1 1 0 9 1 1 0 0 1 1 1
2 1 0 1 1 0 1 1 A 1 1 1 0 1 1 1
3 1 0 0 1 1 1 1 b 0 0 1 1 1 1 1
4 1 1 0 0 1 1 0 C 0 1 1 1 0 0 1
5 1 1 0 1 1 0 1 d 1 0 1 1 1 1 0
6 1 1 1 1 1 0 1 E 1 1 1 1 0 0 1
7 0 0 0 0 1 1 1 F 1 1 1 0 0 0 1
72
79. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
DIO_Lab3 :
Two- digital
Display Module
7 Segment Display
DATA LINES:
- 7SEG_APORTC .4
- 7SEG_BPORTC .5
- 7SEG_CPORTC .6
- 7SEG_DPORTC .7
DECIMAL POINT:
- 7SEG_DPPORTB .0
ENABLE LINES
- 7SEG_EN1PORTC .2
- 7SEG_EN2PORTC .3
The trick is, the human eye cannot capture a frequency
more than 30 HZ. That is if a LED goes ON and OFF
continuously at a rate of 30HZ or more. The eye sees the
LED as continuously ON. However this is not the case.
The LED will be constantly turning ON and OFF. This
technique is called multiplexing.
79
106. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
.elf image contains
debug information
.hex not contain
Any debug information
The compiler can generate different types of files, according to what
you need. On a PC, the compiler generates an executable file with the
extension ”.exe”. However, microcontrollers need a different, dedicated
format. For our microcontroller we will be using HEX (extension ”.hex”)
files. Other possible formats generated by the compiler are: .elf, .map,
.eeprom
106
107. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
AVR Tool-Chain provide
AVR Libc represents the AVR library provided by Atmel. It defines all the
register names (together with their bits), as well as other useful functions.
GCC represents the GNU Compiler Collection. Together with the GNU
binutils it generates the HEX files.
AVR-GDB, AVaRICE, ISIS and SimulAVR can help simulate / debug the
behavior of your microcontroller application on a PC.
107
108. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Simulator versus emulator
An emulator only mimics the observable behaviour of a target, whereas a simulator
also models the internal state of the target. In this respect, emulators are faster,
but they might also be prone to behaviours / errors that the original target would
not manifest.
What is a debugger?
The purpose of a debugger is to allow you to see what is going on “inside” another
program while it executes - or what another program was doing at the moment it
crashed
108
118. https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
DIO_Project2
Seven Segment Digital Clock Our digital clock operates as follows. When the circuit is powered up the clock
starts at "00:00:00" for "HH:MM:SS". There are two push-button switches
used to set the time. Switch SW1 is for setting the minutes, when this button is
pressed the minutes in increase until it reaches 59 then reset and start
counting from 0. Switch SW2 is for setting the hours.
All seven segment displays are driven by the same port (PortB). The
microcontroller through controls from PortC indicate which seven segment
display each digit is displayed on. Note that these Seven Segment Displays
are common cathode display.
118