SlideShare a Scribd company logo
Digital
Input /Output
Driver
Mina Yousry
Copyright © 2012 Embedded Systems
Committee
Agenda:
•

Topics:






•

ATMEGA 32 and DIO
pull up and down resistors
types of switches
switch bouncing
Led ,seven segment and Led Matrix

Practical work :






switching led on and off through sw with delay
switching led on and off through switch
exp of bouncing and solve it through Sw(first time) and Hw(second time)
make any digit on Led matrix
make counter using seven segment
Copyright © 2012 Embedded Systems
Committee
 ATMEGA 32 and DIO:
ATmega 32 has 32 programmable I/O lines divided into 4 PORTS(groups):
1-PORTA(PA7……..PAO)
2-PORTB(PB7….…..PBO)
3-PORTC(PC7….…..PCO)
4-PORTD(PD7……..PDO)

Each PORT is controlled by 3 registers:
1-DDRx (Data Direction Register)
2-PORTx (Output Register)
3-PINx (Input Register

Note: Most pins in Mc make more than one function(multiplexed
functions)
Copyright © 2012 Embedded Systems
Committee
 ATMEGA 32 and DIO (cont.):
ATmega 32 pin out

Copyright © 2012 Embedded Systems
Committee
 ATMEGA 32 and DIO (cont.):
Register controlling I/O port:

Copyright © 2012 Embedded Systems
Committee
 How to set value in register:
Example:
DDRA=5;

//(decimal)mean I activate pin 0 and pin 2 as output
and the rest as input pins

DDRB=0x14;

//(hexadecimal)mean I activate pin 2 and pin 4 as
output and the rest as input pins

DDRC=0b00000011;

//(binary)mean I activate pin 0 and pin1 as output
and the rest as input pins

Copyright © 2012 Embedded Systems
Committee
 How to set a specific pin with conserving
other pins:
To set specified pin with 1:
Make OR operation on the register with The pin no
Example: We want to set pin no 5 with 1
PORTA=PORTA|(0b00100000);

//(decimal)32

To set specified pin with 0:
Make AND operation on the register with (NOT) The pin no
Example: We want to set pin no 3 with 0
PORTB=PORTB&( ~(0b00001000) );

//(decimal)8

Copyright © 2012 Embedded Systems
Committee
 How to set a specific pin with conserving
other pins:
To toggle specified pin with 0:
Make XOR operation on the register with The pin no
Example: We want to set pin no 2 with 0
PORTB=PORTB^(0b00000100) );

//(decimal)4

Copyright © 2012 Embedded Systems
Committee
 ATMEGA 32 and DIO (cont.):
Driving pin:

Copyright © 2012 Embedded Systems
Committee
 Pull up and pull down resistors:
Consider this schematics:
• The input state of most logic gates is called a high impedance.
• the value of the input is considered to be floating.
• Most gates will float towards a high state. This is a very weak condition,
and any electrical noise could cause the input to go low.
• This convert pin as antenna that can receive electrical noise

Copyright © 2012 Embedded Systems
Committee
 Pull up and pull down resistors (cont.):
Solution:

Copyright © 2012 Embedded Systems
Committee
 Switches:
Types of electronics switches
Toggle switch: The toggle switch is usually a two position switch. The internal
construction includes a spring such that it is held firmly in the position to which it
has been switched.
Push button switch: Push button switches are used in many electronic circuits.
These electronic switches are often used when a push action is required to give a
momentary connection.
Rotary switch: As the name implies, rotary switches are operated by turning a knob.
Selecting the correct position enables the relevant connections to be made.

Copyright © 2012 Embedded Systems
Committee
 Switches (cont.):
ON-OFF
Single Pole, Single Throw = SPST

(ON)-OFF
Push-to-make = SPST Momentary

ON-(OFF)
Push-to-break = SPST Momentary

Copyright © 2012 Embedded Systems
Committee
 Switches (cont.):
ON-ON
Single Pole, Double Throw = SPDT

ON-OFF-ON
SPDT Centre Off

Dual ON-OFF
Double Pole, Single Throw = DPST

Copyright © 2012 Embedded Systems
Committee
 Switches (cont.):
Dual ON-ON
Double Pole, Double Throw = DPDT
ON-OFF-ON
DPDT Centre Off

DIP Switch (DIP = Dual In-line Parallel)

Multi-way Switch

Copyright © 2012 Embedded Systems
Committee
 Switches (cont.):
Switch parameters and specifications
1-volltage rating: This is the maximum voltage that the switch can
withstand
.
2-Current carrying rating: The rating of the maximum steady current that a
switch can carry through a closed contact.

3-Contact resistance

4-Number of operations:

Copyright © 2012 Embedded Systems
Committee
 Dealing with Switch Bouncing:
The Problem:
Switch closed:0v
Switch opened:5v
>Due to the mechanical nature of any switch that may contains spring
return action of some kind.

>there wont be a clean transition from a state
to another.

>there will be a series of high and low states
spikes as shown.

Copyright © 2012 Embedded Systems
Committee
 Dealing with Switch Bouncing (cont.):
The Solution:
1-Hardware Based:
>Add a capacitor that makes the voltage smooth
and clean(without spikes).

>the value of R and C determine to react and give
adequate output , As T=RC and the capacitor is full
charged at 5T:
>you can choose R1 = 10 K and C1 = 100 nf
>add a schmitt trigger so that it can output
5v (threshold value)when capacitor Is full
charged.

Copyright © 2012 Embedded Systems
Committee
 Dealing with Switch Bouncing (cont.):
2-Software Based:

>T1 and T2 are fake logic 0 but T3 is the valid one
> Difference between those is their length.

>Make a counter count up as long as the signal is Low, and reset this counter when
the signal is High.
>If the counter reach a fixed value(bigger than T1 or T2) this means that
the pulse is a valid pulse (T3).
Copyright © 2012 Embedded Systems
Committee
 LED:

>we want to calculate value of Resistance that put in serial with Led:
>supply voltage Vcc=5v

>According to datasheet Vd=2v, Id=15mA

>so the value of resistance is 200 ohm
Copyright © 2012 Embedded Systems
Committee
 Seven Segment Display (cont.):

>The required current per small segment is 2mA in very small display

>The current per segment is 60 mA and increase in the case of of larger Display.
>For safe mode we can use a driver such as UDN2981A and UDN2585A IC’s.

Copyright © 2012 Embedded Systems
Committee
 Seven Segment Display:

>UDN2585A can source up to 120 mA while UDN2981A can source up to 500mA.

>So that we can illuminate large displays without burning the Microcontroller.
Copyright © 2012 Embedded Systems
Committee
 LED Matrix:

>We have a Problem here that we have to connect column pins to micro
and the micro pins must be Logic 0.
> so that micro has to sink so much current so that we need a solution.
Copyright © 2012 Embedded Systems
Committee
 LED Matrix (cont.)
The solution
Put ULN2003A IC that output 0 when the input is 1,so we can output Logic 1
from micro that make it protected.

Copyright © 2012 Embedded Systems
Committee
 LED Matrix (cont.)
How we can write alphabet A on Led Matrix???

Copyright © 2012 Embedded Systems
Committee
 LED Matrix (cont.)

Steps

Copyright © 2012 Embedded Systems
Committee
Copyright © 2012 Embedded Systems
Committee
Programming Embedded System I(book)
Esc Presentation
Links:
http://www.kpsec.freeuk.com/components/switch.htm
http://www.electronics-radio.com/articles/electronic_components/switchesrelays/electronics-switches.php
http://www.ikalogic.com/de-bouncing-circuits/
http://www.micahcarrick.com/avr-tutorial-switch-debounce.html

http://embedded-lab.com/blog/?p=2478

Copyright © 2012 Embedded Systems
Committee
info@escommittee.net
education@escommittee.com

Copyright © 2012 Embedded Systems
Committee

More Related Content

What's hot

NMOS fabrication process
NMOS fabrication processNMOS fabrication process
NMOS fabrication process
Semi Design
 
DMA and DMA controller
DMA and DMA controllerDMA and DMA controller
DMA and DMA controller
nishant upadhyay
 
Addressing modes of 80386
Addressing modes of 80386Addressing modes of 80386
Addressing modes of 80386
PDFSHARE
 
Coding verilog
Coding verilogCoding verilog
Coding verilog
umarjamil10000
 
CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE
CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE
CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE
0586umer
 
Rs232 485 fundamental
Rs232 485 fundamentalRs232 485 fundamental
Rs232 485 fundamental
rounak077
 
Basic knowledge of ldo voltage regulators
Basic knowledge of ldo voltage regulatorsBasic knowledge of ldo voltage regulators
Basic knowledge of ldo voltage regulators
Đức Hữu
 
Vlsi stick daigram (JCE)
Vlsi stick daigram (JCE)Vlsi stick daigram (JCE)
Vlsi stick daigram (JCE)
Hrishikesh Kamat
 
Digital electronics and logic design
Digital electronics and logic designDigital electronics and logic design
Digital electronics and logic design
Toufiq Akbar
 
Digital Integrated Circuit (IC) Design
Digital Integrated Circuit (IC) DesignDigital Integrated Circuit (IC) Design
Digital Integrated Circuit (IC) Design
Mahesh Dananjaya
 
Microcontroller 8051 1
Microcontroller 8051  1Microcontroller 8051  1
Microcontroller 8051 1
khan yaseen
 
SRAM
SRAMSRAM
All VLSI programs
All VLSI programsAll VLSI programs
All VLSI programs
Gouthaman V
 
Analog-to Digital Conversion
Analog-to Digital ConversionAnalog-to Digital Conversion
Analog-to Digital Conversion
wajahat Gul
 
Dd sdram
Dd sdramDd sdram
Dd sdram
Ratnakar Varun
 
Types Of Buses
Types Of BusesTypes Of Buses
Types Of Buses
Akhil Ahuja
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Maryala Srinivas
 
Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
Eoin Brazil
 
Viterbi Decoder Algorithm.pptx
Viterbi Decoder Algorithm.pptxViterbi Decoder Algorithm.pptx
Viterbi Decoder Algorithm.pptx
ChandralekhaR2
 
Programmable Logic Devices
Programmable Logic DevicesProgrammable Logic Devices
Programmable Logic Devices
Madhusudan Donga
 

What's hot (20)

NMOS fabrication process
NMOS fabrication processNMOS fabrication process
NMOS fabrication process
 
DMA and DMA controller
DMA and DMA controllerDMA and DMA controller
DMA and DMA controller
 
Addressing modes of 80386
Addressing modes of 80386Addressing modes of 80386
Addressing modes of 80386
 
Coding verilog
Coding verilogCoding verilog
Coding verilog
 
CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE
CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE
CDMA - USE WALSH TABLE TO GENERATE CHIP SEQUENCE
 
Rs232 485 fundamental
Rs232 485 fundamentalRs232 485 fundamental
Rs232 485 fundamental
 
Basic knowledge of ldo voltage regulators
Basic knowledge of ldo voltage regulatorsBasic knowledge of ldo voltage regulators
Basic knowledge of ldo voltage regulators
 
Vlsi stick daigram (JCE)
Vlsi stick daigram (JCE)Vlsi stick daigram (JCE)
Vlsi stick daigram (JCE)
 
Digital electronics and logic design
Digital electronics and logic designDigital electronics and logic design
Digital electronics and logic design
 
Digital Integrated Circuit (IC) Design
Digital Integrated Circuit (IC) DesignDigital Integrated Circuit (IC) Design
Digital Integrated Circuit (IC) Design
 
Microcontroller 8051 1
Microcontroller 8051  1Microcontroller 8051  1
Microcontroller 8051 1
 
SRAM
SRAMSRAM
SRAM
 
All VLSI programs
All VLSI programsAll VLSI programs
All VLSI programs
 
Analog-to Digital Conversion
Analog-to Digital ConversionAnalog-to Digital Conversion
Analog-to Digital Conversion
 
Dd sdram
Dd sdramDd sdram
Dd sdram
 
Types Of Buses
Types Of BusesTypes Of Buses
Types Of Buses
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
 
Viterbi Decoder Algorithm.pptx
Viterbi Decoder Algorithm.pptxViterbi Decoder Algorithm.pptx
Viterbi Decoder Algorithm.pptx
 
Programmable Logic Devices
Programmable Logic DevicesProgrammable Logic Devices
Programmable Logic Devices
 

Viewers also liked

Lin bus
Lin busLin bus
Hindavi Technologies Profile
Hindavi Technologies ProfileHindavi Technologies Profile
Hindavi Technologies Profile
onebhushan
 
ประวัติส่วนตัว
ประวัติส่วนตัวประวัติส่วนตัว
ประวัติส่วนตัวLynnie1177
 
อังกฤษ
อังกฤษอังกฤษ
อังกฤษLynnie1177
 
Bigalytics
BigalyticsBigalytics
Bigalytics
Chidambar Kulkarni
 
Day1
Day1Day1
Montras com livros 2015
Montras com livros 2015Montras com livros 2015
Montras com livros 2015
bibliotecaoureana
 
Sp soft profile (15-may-2012)
Sp soft profile (15-may-2012)Sp soft profile (15-may-2012)
Sp soft profile (15-may-2012)
SP SOFTWARE
 
แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์Lynnie1177
 
Office 2010 migration
Office 2010 migrationOffice 2010 migration
Office 2010 migration
david_malmborg
 
Regulamento concursoleituraconcelho ourem_aeco
Regulamento concursoleituraconcelho ourem_aecoRegulamento concursoleituraconcelho ourem_aeco
Regulamento concursoleituraconcelho ourem_aeco
bibliotecaoureana
 
แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์
Lynnie1177
 
Unlocking funding opportunities final
Unlocking funding opportunities finalUnlocking funding opportunities final
Unlocking funding opportunities final
saqib_bsettlement
 
Matlab workshop
Matlab workshopMatlab workshop
Matlab workshop
محمدعبد الحى
 
Project Report
Project ReportProject Report
Project Report
harshit1991
 
Kbox 101 1000 slide
Kbox 101 1000 slideKbox 101 1000 slide
Kbox 101 1000 slide
david_malmborg
 
Obeijodapalavrinha2miacouto
Obeijodapalavrinha2miacouto Obeijodapalavrinha2miacouto
Obeijodapalavrinha2miacouto
bibliotecaoureana
 

Viewers also liked (20)

Lin bus
Lin busLin bus
Lin bus
 
Hindavi Technologies Profile
Hindavi Technologies ProfileHindavi Technologies Profile
Hindavi Technologies Profile
 
ประวัติส่วนตัว
ประวัติส่วนตัวประวัติส่วนตัว
ประวัติส่วนตัว
 
อังกฤษ
อังกฤษอังกฤษ
อังกฤษ
 
Bigalytics
BigalyticsBigalytics
Bigalytics
 
Gato renato
Gato renatoGato renato
Gato renato
 
Day1
Day1Day1
Day1
 
Montras com livros 2015
Montras com livros 2015Montras com livros 2015
Montras com livros 2015
 
Sp soft profile (15-may-2012)
Sp soft profile (15-may-2012)Sp soft profile (15-may-2012)
Sp soft profile (15-may-2012)
 
แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์
 
Office 2010 migration
Office 2010 migrationOffice 2010 migration
Office 2010 migration
 
Regulamento concursoleituraconcelho ourem_aeco
Regulamento concursoleituraconcelho ourem_aecoRegulamento concursoleituraconcelho ourem_aeco
Regulamento concursoleituraconcelho ourem_aeco
 
คณิต
คณิตคณิต
คณิต
 
แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์แบบโครงร่างโครงงานคอมพิวเตอร์
แบบโครงร่างโครงงานคอมพิวเตอร์
 
Unlocking funding opportunities final
Unlocking funding opportunities finalUnlocking funding opportunities final
Unlocking funding opportunities final
 
Mo ta du an
Mo ta du anMo ta du an
Mo ta du an
 
Matlab workshop
Matlab workshopMatlab workshop
Matlab workshop
 
Project Report
Project ReportProject Report
Project Report
 
Kbox 101 1000 slide
Kbox 101 1000 slideKbox 101 1000 slide
Kbox 101 1000 slide
 
Obeijodapalavrinha2miacouto
Obeijodapalavrinha2miacouto Obeijodapalavrinha2miacouto
Obeijodapalavrinha2miacouto
 

Similar to Dio

UNIT 4 & 5 - I nterfacing_Lecture7.pptx
UNIT 4 & 5 - I         nterfacing_Lecture7.pptxUNIT 4 & 5 - I         nterfacing_Lecture7.pptx
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
naveen088888
 
Advanced motion controls 25a20dd
Advanced motion controls 25a20ddAdvanced motion controls 25a20dd
Advanced motion controls 25a20dd
Electromate
 
Cockpit White Box
Cockpit White BoxCockpit White Box
Cockpit White Box
ncct
 
Badal sharma
Badal sharmaBadal sharma
Badal sharma
badaldausa
 
Advanced motion controls 50a20dd
Advanced motion controls 50a20ddAdvanced motion controls 50a20dd
Advanced motion controls 50a20dd
Electromate
 
Advanced motion controls 50a8dd
Advanced motion controls 50a8ddAdvanced motion controls 50a8dd
Advanced motion controls 50a8dd
Electromate
 
Advanced motion controls 30a8dd
Advanced motion controls 30a8ddAdvanced motion controls 30a8dd
Advanced motion controls 30a8dd
Electromate
 
embedded system
embedded system  embedded system
embedded system
Gopal Dhaker
 
Advanced motion controls azbe12a8
Advanced motion controls azbe12a8Advanced motion controls azbe12a8
Advanced motion controls azbe12a8
Electromate
 
IRJET- IoT based Industrial Automation
IRJET-  	  IoT based Industrial AutomationIRJET-  	  IoT based Industrial Automation
IRJET- IoT based Industrial Automation
IRJET Journal
 
Ge8808 led datasheet
Ge8808 led datasheetGe8808 led datasheet
Ge8808 led datasheet
Greeled Electronic
 
Bluetooth based home appliances control
Bluetooth based home appliances controlBluetooth based home appliances control
Bluetooth based home appliances control
PROJECTRONICS
 
Advanced motion controls bdc30a8
Advanced motion controls bdc30a8Advanced motion controls bdc30a8
Advanced motion controls bdc30a8
Electromate
 
Advanced motion controls az12a8ddc
Advanced motion controls az12a8ddcAdvanced motion controls az12a8ddc
Advanced motion controls az12a8ddc
Electromate
 
Advanced motion controls azbe6a8
Advanced motion controls azbe6a8Advanced motion controls azbe6a8
Advanced motion controls azbe6a8
Electromate
 
Advanced motion controls az6a8ddc
Advanced motion controls az6a8ddcAdvanced motion controls az6a8ddc
Advanced motion controls az6a8ddc
Electromate
 
Elc Inverter Introduction
Elc Inverter IntroductionElc Inverter Introduction
Elc Inverter Introduction
scottburge
 
Embedded System[586]
Embedded System[586]Embedded System[586]
Embedded System[586]
ajeet singh choudhary
 
Advanced motion controls bdc40a20
Advanced motion controls bdc40a20Advanced motion controls bdc40a20
Advanced motion controls bdc40a20
Electromate
 
QuickSilver Controls QCI-DS018 QCI-D2-IG8
QuickSilver Controls QCI-DS018 QCI-D2-IG8QuickSilver Controls QCI-DS018 QCI-D2-IG8
QuickSilver Controls QCI-DS018 QCI-D2-IG8
Electromate
 

Similar to Dio (20)

UNIT 4 & 5 - I nterfacing_Lecture7.pptx
UNIT 4 & 5 - I         nterfacing_Lecture7.pptxUNIT 4 & 5 - I         nterfacing_Lecture7.pptx
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
 
Advanced motion controls 25a20dd
Advanced motion controls 25a20ddAdvanced motion controls 25a20dd
Advanced motion controls 25a20dd
 
Cockpit White Box
Cockpit White BoxCockpit White Box
Cockpit White Box
 
Badal sharma
Badal sharmaBadal sharma
Badal sharma
 
Advanced motion controls 50a20dd
Advanced motion controls 50a20ddAdvanced motion controls 50a20dd
Advanced motion controls 50a20dd
 
Advanced motion controls 50a8dd
Advanced motion controls 50a8ddAdvanced motion controls 50a8dd
Advanced motion controls 50a8dd
 
Advanced motion controls 30a8dd
Advanced motion controls 30a8ddAdvanced motion controls 30a8dd
Advanced motion controls 30a8dd
 
embedded system
embedded system  embedded system
embedded system
 
Advanced motion controls azbe12a8
Advanced motion controls azbe12a8Advanced motion controls azbe12a8
Advanced motion controls azbe12a8
 
IRJET- IoT based Industrial Automation
IRJET-  	  IoT based Industrial AutomationIRJET-  	  IoT based Industrial Automation
IRJET- IoT based Industrial Automation
 
Ge8808 led datasheet
Ge8808 led datasheetGe8808 led datasheet
Ge8808 led datasheet
 
Bluetooth based home appliances control
Bluetooth based home appliances controlBluetooth based home appliances control
Bluetooth based home appliances control
 
Advanced motion controls bdc30a8
Advanced motion controls bdc30a8Advanced motion controls bdc30a8
Advanced motion controls bdc30a8
 
Advanced motion controls az12a8ddc
Advanced motion controls az12a8ddcAdvanced motion controls az12a8ddc
Advanced motion controls az12a8ddc
 
Advanced motion controls azbe6a8
Advanced motion controls azbe6a8Advanced motion controls azbe6a8
Advanced motion controls azbe6a8
 
Advanced motion controls az6a8ddc
Advanced motion controls az6a8ddcAdvanced motion controls az6a8ddc
Advanced motion controls az6a8ddc
 
Elc Inverter Introduction
Elc Inverter IntroductionElc Inverter Introduction
Elc Inverter Introduction
 
Embedded System[586]
Embedded System[586]Embedded System[586]
Embedded System[586]
 
Advanced motion controls bdc40a20
Advanced motion controls bdc40a20Advanced motion controls bdc40a20
Advanced motion controls bdc40a20
 
QuickSilver Controls QCI-DS018 QCI-D2-IG8
QuickSilver Controls QCI-DS018 QCI-D2-IG8QuickSilver Controls QCI-DS018 QCI-D2-IG8
QuickSilver Controls QCI-DS018 QCI-D2-IG8
 

More from محمدعبد الحى

Iso26262 component reuse_webinar
Iso26262 component reuse_webinarIso26262 component reuse_webinar
Iso26262 component reuse_webinar
محمدعبد الحى
 
Interfacing using ِAtmega16/32
Interfacing using ِAtmega16/32 Interfacing using ِAtmega16/32
Interfacing using ِAtmega16/32
محمدعبد الحى
 
Can bus
Can busCan bus
Embedded Systems in Automotive
Embedded Systems in Automotive Embedded Systems in Automotive
Embedded Systems in Automotive
محمدعبد الحى
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
CPU Architecture
CPU ArchitectureCPU Architecture
CPU Architecture
محمدعبد الحى
 
8 bit microcontroller
8 bit microcontroller8 bit microcontroller
8 bit microcontroller
محمدعبد الحى
 
Timers
TimersTimers
Interrupts
InterruptsInterrupts
Uart
UartUart
Sw testing
Sw testingSw testing
Rtos
RtosRtos
Micro controller
Micro controllerMicro controller
Micro controller
محمدعبد الحى
 

More from محمدعبد الحى (13)

Iso26262 component reuse_webinar
Iso26262 component reuse_webinarIso26262 component reuse_webinar
Iso26262 component reuse_webinar
 
Interfacing using ِAtmega16/32
Interfacing using ِAtmega16/32 Interfacing using ِAtmega16/32
Interfacing using ِAtmega16/32
 
Can bus
Can busCan bus
Can bus
 
Embedded Systems in Automotive
Embedded Systems in Automotive Embedded Systems in Automotive
Embedded Systems in Automotive
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
CPU Architecture
CPU ArchitectureCPU Architecture
CPU Architecture
 
8 bit microcontroller
8 bit microcontroller8 bit microcontroller
8 bit microcontroller
 
Timers
TimersTimers
Timers
 
Interrupts
InterruptsInterrupts
Interrupts
 
Uart
UartUart
Uart
 
Sw testing
Sw testingSw testing
Sw testing
 
Rtos
RtosRtos
Rtos
 
Micro controller
Micro controllerMicro controller
Micro controller
 

Recently uploaded

Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 

Recently uploaded (20)

Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 

Dio

  • 1. Digital Input /Output Driver Mina Yousry Copyright © 2012 Embedded Systems Committee
  • 2. Agenda: • Topics:      • ATMEGA 32 and DIO pull up and down resistors types of switches switch bouncing Led ,seven segment and Led Matrix Practical work :      switching led on and off through sw with delay switching led on and off through switch exp of bouncing and solve it through Sw(first time) and Hw(second time) make any digit on Led matrix make counter using seven segment Copyright © 2012 Embedded Systems Committee
  • 3.  ATMEGA 32 and DIO: ATmega 32 has 32 programmable I/O lines divided into 4 PORTS(groups): 1-PORTA(PA7……..PAO) 2-PORTB(PB7….…..PBO) 3-PORTC(PC7….…..PCO) 4-PORTD(PD7……..PDO) Each PORT is controlled by 3 registers: 1-DDRx (Data Direction Register) 2-PORTx (Output Register) 3-PINx (Input Register Note: Most pins in Mc make more than one function(multiplexed functions) Copyright © 2012 Embedded Systems Committee
  • 4.  ATMEGA 32 and DIO (cont.): ATmega 32 pin out Copyright © 2012 Embedded Systems Committee
  • 5.  ATMEGA 32 and DIO (cont.): Register controlling I/O port: Copyright © 2012 Embedded Systems Committee
  • 6.  How to set value in register: Example: DDRA=5; //(decimal)mean I activate pin 0 and pin 2 as output and the rest as input pins DDRB=0x14; //(hexadecimal)mean I activate pin 2 and pin 4 as output and the rest as input pins DDRC=0b00000011; //(binary)mean I activate pin 0 and pin1 as output and the rest as input pins Copyright © 2012 Embedded Systems Committee
  • 7.  How to set a specific pin with conserving other pins: To set specified pin with 1: Make OR operation on the register with The pin no Example: We want to set pin no 5 with 1 PORTA=PORTA|(0b00100000); //(decimal)32 To set specified pin with 0: Make AND operation on the register with (NOT) The pin no Example: We want to set pin no 3 with 0 PORTB=PORTB&( ~(0b00001000) ); //(decimal)8 Copyright © 2012 Embedded Systems Committee
  • 8.  How to set a specific pin with conserving other pins: To toggle specified pin with 0: Make XOR operation on the register with The pin no Example: We want to set pin no 2 with 0 PORTB=PORTB^(0b00000100) ); //(decimal)4 Copyright © 2012 Embedded Systems Committee
  • 9.  ATMEGA 32 and DIO (cont.): Driving pin: Copyright © 2012 Embedded Systems Committee
  • 10.  Pull up and pull down resistors: Consider this schematics: • The input state of most logic gates is called a high impedance. • the value of the input is considered to be floating. • Most gates will float towards a high state. This is a very weak condition, and any electrical noise could cause the input to go low. • This convert pin as antenna that can receive electrical noise Copyright © 2012 Embedded Systems Committee
  • 11.  Pull up and pull down resistors (cont.): Solution: Copyright © 2012 Embedded Systems Committee
  • 12.  Switches: Types of electronics switches Toggle switch: The toggle switch is usually a two position switch. The internal construction includes a spring such that it is held firmly in the position to which it has been switched. Push button switch: Push button switches are used in many electronic circuits. These electronic switches are often used when a push action is required to give a momentary connection. Rotary switch: As the name implies, rotary switches are operated by turning a knob. Selecting the correct position enables the relevant connections to be made. Copyright © 2012 Embedded Systems Committee
  • 13.  Switches (cont.): ON-OFF Single Pole, Single Throw = SPST (ON)-OFF Push-to-make = SPST Momentary ON-(OFF) Push-to-break = SPST Momentary Copyright © 2012 Embedded Systems Committee
  • 14.  Switches (cont.): ON-ON Single Pole, Double Throw = SPDT ON-OFF-ON SPDT Centre Off Dual ON-OFF Double Pole, Single Throw = DPST Copyright © 2012 Embedded Systems Committee
  • 15.  Switches (cont.): Dual ON-ON Double Pole, Double Throw = DPDT ON-OFF-ON DPDT Centre Off DIP Switch (DIP = Dual In-line Parallel) Multi-way Switch Copyright © 2012 Embedded Systems Committee
  • 16.  Switches (cont.): Switch parameters and specifications 1-volltage rating: This is the maximum voltage that the switch can withstand . 2-Current carrying rating: The rating of the maximum steady current that a switch can carry through a closed contact. 3-Contact resistance 4-Number of operations: Copyright © 2012 Embedded Systems Committee
  • 17.  Dealing with Switch Bouncing: The Problem: Switch closed:0v Switch opened:5v >Due to the mechanical nature of any switch that may contains spring return action of some kind. >there wont be a clean transition from a state to another. >there will be a series of high and low states spikes as shown. Copyright © 2012 Embedded Systems Committee
  • 18.  Dealing with Switch Bouncing (cont.): The Solution: 1-Hardware Based: >Add a capacitor that makes the voltage smooth and clean(without spikes). >the value of R and C determine to react and give adequate output , As T=RC and the capacitor is full charged at 5T: >you can choose R1 = 10 K and C1 = 100 nf >add a schmitt trigger so that it can output 5v (threshold value)when capacitor Is full charged. Copyright © 2012 Embedded Systems Committee
  • 19.  Dealing with Switch Bouncing (cont.): 2-Software Based: >T1 and T2 are fake logic 0 but T3 is the valid one > Difference between those is their length. >Make a counter count up as long as the signal is Low, and reset this counter when the signal is High. >If the counter reach a fixed value(bigger than T1 or T2) this means that the pulse is a valid pulse (T3). Copyright © 2012 Embedded Systems Committee
  • 20.  LED: >we want to calculate value of Resistance that put in serial with Led: >supply voltage Vcc=5v >According to datasheet Vd=2v, Id=15mA >so the value of resistance is 200 ohm Copyright © 2012 Embedded Systems Committee
  • 21.  Seven Segment Display (cont.): >The required current per small segment is 2mA in very small display >The current per segment is 60 mA and increase in the case of of larger Display. >For safe mode we can use a driver such as UDN2981A and UDN2585A IC’s. Copyright © 2012 Embedded Systems Committee
  • 22.  Seven Segment Display: >UDN2585A can source up to 120 mA while UDN2981A can source up to 500mA. >So that we can illuminate large displays without burning the Microcontroller. Copyright © 2012 Embedded Systems Committee
  • 23.  LED Matrix: >We have a Problem here that we have to connect column pins to micro and the micro pins must be Logic 0. > so that micro has to sink so much current so that we need a solution. Copyright © 2012 Embedded Systems Committee
  • 24.  LED Matrix (cont.) The solution Put ULN2003A IC that output 0 when the input is 1,so we can output Logic 1 from micro that make it protected. Copyright © 2012 Embedded Systems Committee
  • 25.  LED Matrix (cont.) How we can write alphabet A on Led Matrix??? Copyright © 2012 Embedded Systems Committee
  • 26.  LED Matrix (cont.) Steps Copyright © 2012 Embedded Systems Committee
  • 27. Copyright © 2012 Embedded Systems Committee
  • 28. Programming Embedded System I(book) Esc Presentation Links: http://www.kpsec.freeuk.com/components/switch.htm http://www.electronics-radio.com/articles/electronic_components/switchesrelays/electronics-switches.php http://www.ikalogic.com/de-bouncing-circuits/ http://www.micahcarrick.com/avr-tutorial-switch-debounce.html http://embedded-lab.com/blog/?p=2478 Copyright © 2012 Embedded Systems Committee