مسيطرات كامل

Download as pdf or txt
Download as pdf or txt
You are on page 1of 101

‫جمهورية العراق‬

‫وزارة التعليم العالي والبحث العلمي‬


‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫اسم المادة ‪ :‬مسيطرات رقميه‬


‫المحاضره االولى بعنوان ( ‪) Microcontroller and Microprocessor‬‬
‫اسم التدريسي‪ :‬م‪.‬م سماره خميس‬
What is Microcontroller (MCU)?
• Microcontroller: An integrated electronic computing
device or a small computer on a single integrated circuit
that includes three major components on a single chip
• The microprocessor (MPU).
• Memory.
• I/O (Input/Output) ports.
• Embedded Systems
• An embedded system is a product that uses a computer to
run it but the product itself is not a computer.
What is a microprocessor (MPU)?
• A microprocessor is generally known as the “brain” of a
computer.
• Contains a large number of transistors.
• Microprocessor deals with organizational tasks and math
operations.
• The microprocessor is packaged as a single integrated
circuit, and this requires a large number of external
components to function, such as:
• Memory,
• Timing circuits,
• Input / output devices.
Microcontrollers vs. Microprocessors

Arduino UNO
Raspberry PI 3
The Difference between µC and µP
• µC (microcontroller):
o RAM
o ROM
o I/O ports
o Timer
o ADC and other peripherals
o No. of bits (8-32) bits
o Low cost

• µP (microprocessor):
o No RAM
o No ROM
o No I/O ports
o No. Of bits (32-64) bits
o High cost
Types of Microcontrollers:
o Microcontrollers can be classified on the basis of internal bus width,
architecture, memory, and instruction set.

o When the ALU performs arithmetic and logical operations on a byte (8- bits)
at an instruction, the microcontroller is an 8-bit microcontroller. The internal
bus width of the 8-bit microcontroller is 8-bit. Examples of 8-bit
microcontrollers are Intel 8051 family and Motorola MC68HC11 family.

o When the ALU performs arithmetic and logical operations on a word (16-
bits) at an instruction, the microcontroller is a 16-bit microcontroller. The
internal bus width of the 16-bit microcontroller is 16-bit. Examples of 16-bit
microcontrollers are Intel 8096 family and Motorola MC68HC12 and
MC68332 families.
o The performance and computing capability of 16-bit microcontrollers are
enhanced with greater precision as compared to the 8-bit microcontrollers.
Types of Microcontrollers:
• When the ALU performs arithmetic and logical operations on a
double word (32- bits) at an instruction, the microcontroller is a
32-bit microcontroller. The internal bus width of the 32-bit
microcontroller is 32-bit. Examples of 32-bit microcontrollers are
Intel 80960 family and Motorola M683xx and Intel/Atmel 251
family.

• - The performance and computing capability of 32-bit


microcontrollers are enhanced with greater precision as compared
to the 16-bit microcontrollers.
Various types of Microcontrollers.
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫اسم المادة ‪ :‬مسيطرات رقميه‬


‫المحاضره الثانيه بعنوان‬
‫)‪) Microcontroller application and its components‬‬
‫اسم التدريسي‪ :‬م‪.‬م سماره خميس‬
Memory Architecture in Microcontrollers
• All MCs use one of two basic design models
• - Harvard Architecture:
• data bus and address bus are
• separate. Thus a greater flow
• of data is possible through
• the CPU, and of course,
• a greater speed of work.

• - Von –Neumann (Princeton):


• This model uses share a common
• bus for data and address bus.
Microcontroller Applications:
• These small devices have revolutionized the world of electronics. Today microcontrollers are
everywhere, think of a device and you will find a microcontroller somewhere in it.
• May it be yours:
• Remote control,
• Cell phone
• Air conditioner,
• Microwave oven,
• DVD player,
• The home monitoring system,
• Environmental control (greenhouse, factory, home) television.
• These small devices can do so much, that only imagination is the limit.
• They are very simple to use, you don't need to be an expert in electronics to use them in your next
project.
Microcontroller Components
1. The central processing unit (CPU)
2. Read-Only Memory (ROM)
3. Random Access Memory (RAM)
4. Special Function Registers (SFR)
5. Input /Output Ports
6. Serial Communication
7. Timers/Counters
8. A/D Converter
9. Power Supply Circuit
10. Oscillator
1. Central Processing Unit (CPU)

This is a unit that monitors and controls all processes within the microcontroller and the user cannot
affect its work.

It consists of several smaller subunits, of which the most important are:


a) Instruction decoder
b) Arithmetical Logical Unit (ALU)
c) Register
2. Read Only Memory (ROM)
• Read-Only Memory (ROM) is a type of memory used to permanently save the program being
executed.

• The size of the program that can be written depends on the size of this memory.

• ROM can be built in the microcontroller or added as the external chip, which depends on the
type of the microcontroller.

• Today’s microcontrollers commonly use 16-bit addressing, which means that they are able to
address up to 64 Kb of memory, i.e. 65535 locations. As a novice, your program will rarely
exceed the limit of several hundred instructions.
6
3. Random Access Memory (RAM)
 Random Access Memory (RAM) is a type of memory used for temporary storing data and
intermediate results created and used during the operation of the microcontrollers.

 The content of this memory is cleared once the power supply is off.

 EEPROM (Electric Erasable Programmable ROM) Data Memory: EEPROM-type data memory is
also very common in many microcontrollers.

 The advantage of an EEPROM memory is that the programmer can store nonvolatile data there
and change this data whenever required. For example, in a temperature monitoring application, the
maximum and minimum temperature readings can be stored in EEPROM memory. If the power
supply is removed for any reason, the values of the latest readings are available in the EEPROM
memory.
4. Registers & Special Function Registers (SFR)

 Register (memory cell): is an electronic circuit that can


memorize the state of one byte.

 Special Function Registers (SFR)


 Special Function Registers are part of RAM memory.
 Every microcontroller has a number of registers (SFR) whose
function is predetermined by the manufacturer.
 (SRF) bits are physically connected to particular circuits within
the microcontroller such as timers, A/D converter, oscillators,
etc.,
 Any change in (SFR) state affects the operation of the
microcontroller or some of the circuits
5. Input /Output Ports
• In order to make the microcontroller useful, it has to be
connected to additional electronics, i.e. peripherals.
• Each microcontroller has one or more registers (called a port)
connected to the microcontroller pins.
• The microcontroller will be connected to the peripheral
devices through the pins connected to the port register.

• TRIS registers used for choosing if the PORTx pin should be


an input or output (1 for input 0 for output).
• Any bit in a PORTx can be input if the equivalent bit in the
TIRSx register is (1) and output if the equivalent bit in the
TRISx register is (0). For example: if we want PORTx bit 6 as
an output, TRISx 6 should be 0.
6. Serial Communication
• Serial communication (also called RS232 communication) enables a
microcontroller to be connected to another microcontroller or to a PC using a
serial cable.
• Some microcontrollers have built-in hardware called USART (universal
synchronous asynchronous receiver-transmitter) to implement a serial
communication interface.
• The user program can usually select the baud rate and data format.
• Some microcontrollers (e.g., the PIC18F series) incorporate SPI (serial
peripheral
• interface) or I2C (integrated interconnect) hardware bus interfaces.
• These enable a microcontroller to interface with other compatible devices
easily.
7. Timers/ Counters
• Timers are important parts of any microcontroller.
• A timer is basically a counter which is driven from either an external clock pulse or
the microcontroller’s internal oscillator.
• A timer can be 8 bits or 16 bits wide.
• Data can be loaded into a timer under program control, and the timer can be stopped
or started by program control.
• Most timers can be configured to generate an interrupt when they reach a certain
count (usually when they overflow).
• For example, the PIC18F452 microcontroller has three built-in timers.

• Counters: If the timer receives pulses from the microcontroller input pin, then it
turns into a counter. Obviously, it is the same electronic circuit able to operate in two
different modes. The only difference is that in this case pulses to be counted come
over the microcontroller input pin and their duration (width) is mostly undefined.
8. A/D Converter

• An Analogue to Digital (A/D) converter is an electronic circuit. Which


converts continuous signals to discrete digital numbers. In other words, this
circuit converts an analog value into a binary number and passes it to the
CPU for further processing.

• This module is used for input pin voltage measurement (analog value). The
result of the measurement is a number (digital value) used and processed later
in the program.

• A/D converters are especially useful in control and monitoring applications


since most sensors (e.g., temperature sensors, pressure sensors, force sensors,
etc.) produce analog output voltages.
9. Power Supply Circuit

• There are two things worth attention concerning the


microcontroller power supply circuit:

• Brown Out
• It is a potentially dangerous state which occurs when the
microcontroller is being turned off or when the power supply
voltage drops to the lowest level due to electric noise.
• Reset Pin
• Master Clear Reset (MCLR) serves for the external reset of the
microcontroller. Reset puts the microcontroller into a known
state. Usually, after a reset, the program starting from memory
address 0 of the microcontroller is executed
10. Oscillator
• An electronic circuit that produces a periodic oscillating electronic signal often a sine
wave or square wave.

• There are different modes of oscillators like:


• Low Power Crystal (LP)
• Crystal/Resonator (XT)
• High-Speed Crystal/Resonator (HS)
• Resistor Capacitor (RC)

• We use capacitors with the oscillators to reduce noises and we chose the values of the
capacitors depending on the oscillator frequency and type.
• There are four steps taken by the CPU to do an instruction:

• One of the factors that control the speed of the microcontroller is the frequency
• of the oscillator.
• 1. Fetch
• 2. Decode
• 3. Execute
• 4. Transfer
• Thanks for listening

• Good Luck
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫‪Digital Controller‬‬
‫‪Lecture 3 - C Programming Language‬‬
‫م‪.‬م سماره خميس‬
• Programming is writing the instruction that the Microprocessor will
do.
• At first programs were written in Machine Code (0, 1).
• Then Assembly Language was invented as the hardware became
complex and we needed to make an easier language.
• Then the higher level languages were invented, They are much
easier than assembly Language (C, Java, Python).
1 /* Fig. 2.1: fig02_01.c
2 A first program in C */
3 #include <stdio.h>
4
5 int main()
6 {
7 printf( "Welcome to C!\n" );
8
9 return 0;
10 }

Welcome to C!
We use Variables and constants to store the data of the program
and deal with them like doing mathematical operations or
displaying their values.
Variables are stored in RAM so we can change their values during
the program.
Constants are stored in ROM so we can't change their values during
the program.
• To declare a variable we need to describe the following:
1. Variable Type.
2. Variable name.
3. Value of the Variable (not a must).
And we write the declaration statement like this:

Variable Type Variable name = Variable Value;


– Variable Names must be Unique.
– Variable Names must begin with alphabetical characters (uppercase
or lowercase) or Underscore characters.
– It may contain numbers and can contain uppercase or lowercase
characters.
– Variable Names must not be like the reserved names of the compiler.
– It must not contain any special characters like ( ) : ; _ " ' & % $ # } [ { ].
– Examples:
• Correct Variable Names: (sum, Result, student_1, Student4, _sum).
• Wrong Variable Names: (5student, 5_student, #sum, if, switch, while, enum, case, else, asm, goto .....
– int x ;
– char n = 'A' ;
– float sum = 0 ;
– long z =12 ;
– Int L = 0b110011 ;
 Declaring a constant is just like declaring a variable, we just put the word const before the
variable type.
 As we can't change the value of the constants during the program so we must put their value
when declaring them.
 Examples:
const int x = 5 ;
const char ch_1 = 'L' ;
• Array used to store elements with the same type in memory.
• We may use arrays to one operation to more than a couple of variables like
adding three number to another three numbers in the same time.
• Arrays will help you to store and handle data easily during the program such as
in loops and many other uses.
 Like a variable with declaring name and type but we need to
add the number of elements (optional).
 Index of the elements of an array begins from zero.

 char name [ ] = "Ahmed" ;


 int numbers [4] = {1, 2, 3, 4} ;
 char name [ ] = {'A', 'h', 'm', 'e', 'd'} ;
 Arithmetic operators.
 Relational operators.
 Logical operators.
 Bitwise operators.
 Preprocessor operators.
 Arithmetic operators
 Logical operators
 Relational operators

 Bitwise operators
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫‪Digital controllers‬‬
‫‪Lecture -4-‬‬
‫) ‪) Arduino‬‬
‫م‪.‬م سماره خميس‬
What is a Microcontroller (µC, MCU)
 Computer on a single integrated chip
 Processor (CPU)
 Memory (RAM / ROM / Flash)
 I/O ports (USB, I2C, SPI, ADC)
 Common microcontroller families:
 – Intel: 4004, 8008, etc.
 Atmel: AT and AVR
 Microchip: PIC
 ARM: (multiple manufacturers)
 Used in:
 Cellphones,
 Toys
 Household appliances
 Cars
 Cameras
What is Arduino Not?
 It is not a chip (IC)
 It is not a board (PCB)
 It is not a company or a manufacturer
 It is not a programming language
 It is not a computer architecture

 (although it involves all of these things...)


what is Arduino?
 It’s a movement, not a microcontroller:
 Founded by Massimo Banzi and David Cuartielles in
2005
 Based on “Wiring Platform”, which dates to 2003
 Open-source hardware platform
 Open source development environment
 Easy-to learn language and libraries (based on Wiring
language)
 Integrated development environment (based on
Processing programming environment)
 Available for Windows / Mac / Linux
The Many Flavors of Arduino
 Arduino Uno
 Arduino Leonardo
 Arduino LilyPad
 Arduino Mega
 Arduino Nano
 Arduino Mini
 Arduino Mini Pro
 Arduino BT
Inputs and Outputs
SIK )Inventor’s kit for arduino)
components
Getting
Gettingto
to know theArduino:
know the Arduino:
Electrical
ElectricalInputs
Inputs and
and Outputs
Outputs
• Input voltage: 7-12 V LED 14 digital inputs/outputs
(USB, DC plug, or Vin) (6 PWM outputs
Power
• Max output current per pin: 40 mA
indicator

USB connection Reset


Button
16MHz clock

Voltage regulator P328ATmega

AC/DC adapter
jack DC voltage
6 analog
supply
inputs
(IN/OUT)
Arduino Sketch Structure

• void setup)( void setup{ )(


//put your setup code here, to run once:

◦ Will be executed }

void loop{ )(
only when the //put your main code here, to run repeatedly:

program begins }

(or reset button


is pressed) Text that follows // is a
comment (ignored by compiler)
• void loop)(
◦ Will be executed Useful IDE Shortcut: Press Ctrl‐/
to comment (or uncomment) a
selected portion of your program.
repeatedly
Digital Input: Reading Switches and Buttons
Writing HIGH to an input pin:
enables an internal pull-up resistor

void setup() {
pinMode(11, OUTPUT); //Use pin 11 for digital out
pinMode(12, INPUT); //Use pin 12 for digital input
digitalWrite(12, HIGH); //Enable pull‐up resistor
}

void loop() {
boolean state;
state =digitalRead(12); // read state of pin 12
digitalWrite(11, state); // set state of pin 11 (LED)
delay(;)100 // wait for a 1/10 second
}

• Turn on/off LED based on switch


• Pin 12 reads LOW when switch is closed
• Pin 12 reads HIGH when switch is open (pull-up)
Without the internal pull-up resistor, unconnected
digital inputs could read either high or low
Thank you for listening ….
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫‪Digital controllers‬‬
‫‪Lecture -5-‬‬
‫)‪(7-Segment Display‬‬
‫م‪.‬م سماره خميس‬
Outlines:-
1. 7-segment Display Introduction
2. 7-Segment Display Features
3. Selecting your 7-Segment Display
4. Seven-Segment Display Table
5. How to use a 7-Segment display
6. 7-Segment Display Pin Configuration
7. Applications
7-segment Display Introduction
 The seven segments displays are the oldest yet one of the efficient types of display used in
embedded applications. This display has nothing more than 8 LEDs inside it. These 8 LEDs
are separated into each segment which can be named as a,b,c,d,e,f,g, DP as shown in the
picture.

 These entire 8 segment LEDs have one end of their pins pulled out of the module as
shown above and the other ends are connected together and pulled out as the Common
pin.
 So to make an LED of a particular segment glow we just have to power the common pin
along with the segment pin. This way we can power more than one segment at a time to
represent the numeric number 0-9
7-Segment Display Features
 Available in two modes Common Cathode (CC) and Common Anode (CA)
 Available in many different sizes like 9.14mm, 14.20mm, 20.40mm, 38.10mm,
57.0mm and 100mm (Commonly used/available size is 14.20mm)
 Available colors: White, Blue, Red,Yellow and Green (Res is commonly used)
 Low current operation
 Better, brighter, and a larger display than conventional LCD displays.
 Current consumption : 30mA / segment
 Peak current: 70mA
Selecting your 7-Segment Display
 As discussed in the Features there are many options to
choose from for a 7-segment display. Their many
different types of size and colors to select from. The
default and most commonly used / available one is the
14.20mm with Red color display as shown in the above
animation. If you are planning to make your project
look out of the box, then other color displays can also
be used. Also, note that as size and color differ the
amount of current consumed by the display will also
differ. The Red color one is universally used since it
consumes less current than other colors.
 Now, there is another important parameter that you have to
concentrate on before buying this module. That is either a
Common Anode display or a Common Cathode display. We cannot
use a circuit/program designed for Common Anode display for
Common Cathode or vice versa
Seven-Segment Display Table
How to use a 7-Segment display
 One important advantage of a 7-segment display is that it is very easy to use. Unlike other display
modules, a 7-segment display can be made to work even without a Microcontroller or a Microprocessor.

 This is possible because of the readily available 7-segment counter IC’s like IC CD4026. This IC can be
used in combination with the display for projects which have very simple circuits. The IC can drive one
7-segment display module and the number that is being displayed can also be incremented or
decremented.

 But, most commonly a seven-segment display is used along with an MCU/MPU in that case, the eight
segment pins will be connected to the I/O pins of the Microcontroller and the com pin will be
connected to the ground of Vcc depending upon its type (CC/CA). Then these IO pins can be toggled
in a particular sequence to display the desired numbers. For displaying each number in the seven-
segment display its respective sequence is given in the table. If we want to display the number “0”, then
we need to glow all the LEDs except LED which belongs to line “g”
7-Segment Display Pin Configuration
Applications
• 1- Used in applications where font size is required to be bigger
• 2- Microcontroller Independent, hence used in small circuit
projects
• 3- Used in combination with four segments to display
measurement/sensor value with four characters
• 4- Has bright illumination, hence used where the display is
required to work in low light or dark conditions
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫‪Digital controllers‬‬
‫‪Lecture -6-‬‬
‫)‪PIC microcontrollers ( Programmable Interface Controllers‬‬
‫‪Input / Output ports‬‬
‫م‪.‬م سماره خميس‬
PIC microcontrollers
I/O Introduction

I/O is one of the most basic and critical functions of the PIC
microcontroller.
It is the method that we use to interface with the externals
we are trying to control.
PIC 8-bit I/O is quite robust and supports fairly high output
currents of up to 100mA.
The PIC16F18875 has 35 I/O points, organized into five
ports, A E
PIC microcontrollers
I/O

Ports

 The older PIC only had a few registers needed to set up the I/O ports.
 This newer one has quite a few more.
 This makes it more difficult to set up, but it also leads to a much more
powerful I/O system.
 PORTx registers (reads the levels on the pins of the device)
 LATx registers (output latch)
 TRISx registers (data direction)
 ANSELx registers (analog select)
Ports
 WPUx registers (weak pull up)

 CCDPx registers (current control positive)

 CCDNx registers (current control negative)

 INLVLx (input level)

 SLRCONx registers (slew rate)

 ODCONx registers (open-drain)


TRIS Registers

 There is an 8 bit Tri-State Control (TRIS) register TRISx associated with every
Port.
 Port E will only use 3 of the 8 bits.
 This is called a direction control register by most people. If a bit is set to 1 it is an
input, if a bit is set to 0 it is an output.
 What it really does is enable (0) or disable (1) the output. Every pin can be used
as an input, even if the output is enabled. This can lead to problems if you are not
careful.
LAT Registers

 There is an 8-bit LATx register for every Port.
 This register provides access to the output latches.
 The LAT register is the preferred method of writing to an output,
though the output pin can be written directly.
 You can also read from the latch register, which has the effect of
retrieving the last value written to a pin.
ANSEL Registers

 The Analog select register ( ANSELx ) determines whether
a particular port pin is an analog (1) or digital (0).
 It is possible to read digitally from a pin set to analog, but
this can lead to unintended consequences and damaged
port pins.
Weak Pull-Up Registers

 The bits in these registers can enable (1) an onboard pull-
up resistor to prevent current overload conditions.
 We would normally include this in our design, but this
option allows you to save space on the board and use an
internal resistor instead.
Interrupt On Change Registers

The bits in this pair of registers can enable (1) an
interrupt if a change of state is detected on a pin.
There is a pair to detect a change of rising edge or falling
edge
You will see this in alarm systems, or warning systems.
This can even be used to wake up a processor from sleep
mode.
Plastic Dual Inline Package (PDIP) Package
Pinout

Thank you for listening

‫جويٌريت العراق‬
‫ًزارة التعلين العالي ًالبحث العلوي‬
‫جاهعت االهام جعفر الصادق (عليو السالم) – كركٌك‬
‫كليت تكنلٌجيا الوعلٌهاث – قسن ىندست تقنياث الحاسٌب‬

‫‪Digital controllers‬‬
‫‪Lecture -7-‬‬
‫)‪PIC microcontrollers ( Programmable Interface Controllers‬‬
‫‪Input / Output ports part -2-‬‬
‫م‪.‬م سواره خويس‬
I/O Port
 The latch register allows you to
read the latch state of the Flip Flop
instead of the input state.The TRIS
register determines if the port is an
input or an output. If it is a 1, then
the port is an input. If it is a 0, then
the port is an output

Buffers
I/O Port

Flip-Flop
I/O Port

Logic Gate
DC Electrical Characteristics
Port A Registers
 PORTA is an 8 bit wide, bidirectional port. The corresponding data direction register is TRISA.
Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., disable the output
driver). Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., enables
output driver and puts the contents of the output latch on the selected pin).
 Reading the PORTA register reads the status of the pins, whereas writing to it will write to the
PORT A latch.
 All write operations are read modify write operations. Therefore, a write to a port implies that the
port pins are read, this value is modified and then written to the PORT data latch (LATA).

 The PORT data latch LATA holds the output port data and contains the latest value of a LATA or
PORTA write. The TRISA register controls the PORTA pin output drivers, even when they are
being used as analog inputs. The user should ensure the bits in the TRISA register are maintained
set when using them as analog inputs. I/O pins configured as analog inputs always read ‘0’.
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫‪Digital controllers‬‬
‫‪Lecture -8-‬‬
‫‪EEPROM‬‬
‫م‪.‬م سماره خميس‬
EEPROM
 The EEPROM is stands for: Electrically Erasable
Programmable Read Only Memory.
 This is non-volatile memory which means any data
which will be written to the EEPROM will be
remain in the memory even when no power is
supplied and it can be read at any time to retrieve
the data.
 NOTE
 Important fact to note is that the AVR’s internal
EEPROM memory has a limited lifespan of 100,000
writes per EEPROM. Keep this in mind and always try to
keep writes to a minimum, so that you only write the
least amount of information required for your
application each time you update the EEPROM.

 ** AVR is a family of microcontrollers


Types of EEPROM Memory
 There are two main types of memory are available from the family of
EEPROM memory devices.
 1- Serial EEPROM Memory
 The operation of serial EEPROM memory is complicated, and data transferred serially. So,
this makes them slow as compared to the parallel EEPROM. Also, serial EEPROMs are
less dense and are much cheaper.

 2- Parallel EEPROM memory


 The operation performed by parallel EEPROM memory is much faster as compared to
the serial EEPROM memory. Parallel EEPROM memory is much denser and reliable than
serial EEPROM memory. Parallel EEPROMs are more substantial, and due to their cost,
there is very low popularity of parallel EEPROMs.
Advantages of EEPROM Memory
1. We can reprogram EEPROM an infinite number of
times.
2. The method of erasing the data is immediate and is
electrical.
3. We can program and erase the contents of EEPROM
without removing the chip from the computer.
4. There is no requirement for additional equipment for
changing the contents.
5. We can erase the data on an EEPROM byte by byte
basis.
Disadvantages of EEPROM Memory
1. There is a requirement of different-2 voltages for
erasing, reading, and writing the data onto the
EEPROM memory.
2. EEPROM has limited retention time.
3. It is expensive as compared to the PROM and
EPROM.
4. The serial EEPROM memory requires more time
for execution.
Registers in EEPROM
 The registers is associated with EEPROM of the AVR are:
 EEAR: EEPROM Address Registers
 The EEPROM module needs a 9 bit address to access the
512 bytes of memory. So the address registers the
EEARH and EEARL for high for high and low bits.
Registers in EEPROM
 Bits 9 to 15 are reserved
 Bits 8 to 0 are R/W bits and are used to specify location
where the data is to be written or the data has to be
read from.
Registers in EEPROM
 EEDR:
 The EEDR is the EEPROM data register and any
kind of value can be written
 This register value will be written to the EEPROM
 EECR:
 This is the EEPROM Control Register
 Bits 7 to 4 are reserved
Registers in EEPROM
 EERIE: EEPROM Ready Interrupt Enable
 EEMWE: EEPROM Master Write Enable
 EEWE: EEPROM Write Enable
 EERE: EEPROM Read Enable
‫جمهورية العراق‬
‫وزارة التعليم العالي والبحث العلمي‬
‫جامعة االمام جعفر الصادق (عليه السالم) – كركوك‬
‫كلية تكنلوجيا المعلومات – قسم هندسة تقنيات الحاسوب‬

‫‪Digital controllers‬‬
‫‪Lecture -9-‬‬
‫‪How to read Analog Signals in PIC Microcontrollers‬‬
‫م‪.‬م سماره خميس‬
Analog to digital Converter(ADC(
• Analog to Digital Converter (ADC) is an electronic integrated
circuit used to convert the analog signals such as voltages to
digital or binary form consisting of 1s and 0s. Most of the ADCs
take a voltage input as 0 to 10V, -5V to +5V, etc., and
correspondingly produces digital output as some sort of a binary
number.
ADC
• ADCs can vary greatly between
microcontrollers. The ADC on the Arduino is a
10-bit ADC meaning it has the ability to detect
1,024 (2^10) discrete analog levels. Some
microcontrollers have 8-bit ADCs (2^8 = 256
discrete levels) and some have 16-bit ADCs
(2^16 = 65,536 discrete levels).
Liquid-Crystal Display (LCD):
A liquid-crystal display (LCD) is a flat-panel display or another electronically modulated
optical device that uses the light-modulating properties of liquid crystals combined with
polarizes.

in this subject we choose one of the types of the crystal screen, which is 2 * 16, which is
considered the most popular, as well as the most common among electronic tools and in
electronic projects because to its availability at a low price and also for its ease of
programming since the Arduino, contains ready offices to facilitate dealing with this type
of screens. As shown in the figure below:

NOTE: It was named by this name because it contains two lines and 16 columns, so the
screen has a parallel communication system. As shown in the figure:
Using of LCD: -
LCDs are used in a wide range of applications, including:

 LCD televisions, computer monitors, instrument panels, aircraft cockpit displays,


and indoor and outdoor signage.
 Also small LCD screens are common in LCD projectors and portable consumer
devices such as digital cameras, watches, digital clocks, calculators, and mobile
telephones, including smartphones.

 Advantages of LCD:
1- Very compact, thin, and light.

2- Low power.

3- Can be made in almost any size or shape.

 Disadvantages of LCD:
1. Loss of brightness.
2. Loss of contrast in high-temperature environments.
3. Black levels may not be as dark as required.

You might also like