Professional Documents
Culture Documents
Welcome To Day 2 !
Welcome To Day 2 !
Welcome To Day 2 !
Topics to be covered:
1. Microcontroller Architecture
2. Difference between microcontroller and microprocessor
0 3.
4.
AVR microcontrollers
Bits and Bytes
5. Bitwise operators
6. Registers
7. Types of registers
8. Data Sheet
9. Example: Generating a pwm signal
Microcontrollers &
Microprocessors
Microprocessor consists of only a Central Processing Unit, whereas
Micro Controller contains a CPU, Memory, I/O all integrated into one
chip. Microprocessor uses an external bus to interface to RAM,
4 3.
by exposing it to strong ultraviolet light source (mercury-vapor lamp)
EEPROM : Electrically erasable programmable read-only memory
device, a negative pulse is applied, which causes the electrons to
tunnel back out and return the floating gate to near its original state.
4. Flash memory : Flash memory is intermediate between EPROM and
EEPROM, like EEPROM, flash memory uses an electrical erasing
technology. An entire flash memory can be erased in one or a few
seconds, which is much faster than EPROM. Flash memory does not
provide byte-level erasure
Have you ever worked with
an AVR processor?
Arduino UNO
(DIY 😂)
The Arduino is an AVR processor running special code that
lets you use the Arduino environment to program and upload
code easily.
What does an arduino
development board look like?
● Power (USB / Barrel Jack)
● 5.5 V & 3V
● GND
● AREF
● Analog pins
● Digital pins
● PWM pins
● Power LED indicator
● TX RX LEDs
● Main IC
How to connect these
pins?
→ Permanent soldering
→ Breadboard
How to program these
AVR Microcontrollers
Good news!!
12
1. The AVR's program is stored in nonvolatile (persistent on
power-down) programmable Flash memory. It is divided into 2
sections. The first section is the Application Flash section. It is where
the AVR's program is stored. The second section is called the Boot
Flash section and can be set to execute immediately when the device
4 2.
is powered up.
All the code you write is linked, assembled and otherwise compiled
into hex code, (also known as byte code) which is a series of
hexadecimal numbers that are interpreted as instructions by the
microcontroller.
3. Can be programmed using Arduino IDE or AVR studio 4
Let’s learn to program
an arduino using
arduino IDE
● setup() function
● loop() function
● pinMode()
● digitalRead()
● digitalWrite()
● analogWrite()
And many more…..
Start tinkering
your circuits!!!
For AVR programming you
need to use datasheet for
which you need to know
4 how to read it. So let’s take
some time to learn “ABCD”
of embedded
Before starting with AVR programming, Let’s learn about registers
The AVR's data memory is volatile RAM. It is organized in 8-bit
registers.All information in the microcontroller, from the program
memory, the timer information, to the state on any of input or
output pins, is stored in registers. Registers are like shelves in the
bookshelf of processor memory. In an 8-bit processor, like the one
we are using, the shelf can hold 8 books, where each book is a one
bit binary number, a 0 or 1. Each shelf has an address so that the
controller knows where to find it. Some registers, such as those in
RAM, are for storing general data. Others have specific functions
like controlling the A/D converters or timers, or setting and getting
values on the I/O pins. Registers in RAM can be read or written.
Other registers may be read-only or write-only. In fact, some
specialized registers may have certain bits that are only to be
read, and certain bits that are only to be written.
Bitwise operators
A = 10010110
B = 11110001
A|B = ?
To write 0 in bit c of register A: A = A&(~(1<<c))
To write 1 in bit c of register A: A=A|(1<<c)
You are all set to learn
AVR coding!!!
See you tomorrow!!!
Thank you!