SlideShare a Scribd company logo
1 of 36
M.SARASWATHI
Associate Professor
Department of ECE
Panimalar Engineering College
MICROCONTROLLER PROGRAMMING - AN OVERVIEW
A Webinar on
Contents
1. Why programming is important?
2. Input and Output devices for
microcontroller
3. Application of Microcontroller
4. Interfacing Keypad with
microcontroller
5. Keypad Matrix Scanning concept.
6. ALP for interfacing keypad with
LCD.
2
Why Programming is important?
There are three types or levels of
Programming Languages for
8051 Microcontroller.
1. Machine Language
2. Assembly Language
3. High-level Language
Programming in the sense of Microcontrollers means writing
a sequence of instructions to perform a predefined task.
3
 Toys movement of Left,
Right – both legs and
hands is Predefined Task
JOB OPPORTUNITY
Microcontroller Programming
4
More than 650 jobs daily
1. Senior Application & Design Support Engineer (Peenya Loc)
600000 - 900000 INR P.A.
2. Hardware Design Engineer
160000 - 420000 INR P.A.
3. Embedded Software Design Engineer
₹ 3,00,000 - 8,00,000 P.A.
4. Senior Engineer - Embedded Development –
Microcontroller/qt/c++ - Contactx
300000 - 600000 INR P.A.
5. Embedded Software Engineer
Zettaone Technologies India Pvt. Ltd
300000 - 600000 INR P.A.
JOB OPPORTUNITY
Microcontroller Programming- Fresher
Samples of South Indian companies
5
 Assembly Language is a pseudo-English representation
of the Machine Language.
 The 8051 Microcontroller Assembly Language is a
combination of English like words called Mnemonics
and Hexadecimal codes.
 It is also a low level language and requires extensive
understanding of the architecture of the Microcontroller.
Why Assembly Language?
6
 The Programs written in Assembly gets executed faster and
they occupy less memory.
 With the help of Assembly Language, you can directly
exploit all the features of a Microcontroller.
 Using Assembly Language, you can have direct and
accurate control of all the Microcontroller’s resources like
I/O Ports, RAM, SFRs, etc.
 Compared to High-level Languages, Assembly Language
has less rules and restrictions.
Advantage of Assembly Language Programming
7
Input and Output devices for microcontroller
8
APPLICATION OF MICROCONTROLLER
9
 Hex key pad is essentially a collection of 16 keys
arranged in the form of a 4×4 matrix.
 Hex key pad usually
have keys representing
numeric 0 to 9 and
characters A to F.
HEX KEYPAD (or) 4x4 MATRIX
10
 The hex keypad has 8 communication lines namely R1,
R2, R3, R4, C1, C2, C3 and C4.
 R1 to R4 represents the four rows.
 C1 to C4 represents the four columns.
 When a particular key is pressed the corresponding row
and column to which the terminals of the key are
connected gets shorted.
11
 The program identifies which key is pressed by a
method known as column scanning.
 In this method a particular row is kept low (other rows
are kept high) and the columns are checked for low.
 If a particular column is found low then that means that
the key connected between that column and the
corresponding row (the row that is kept low) is been
pressed.
For example :
If row R1 is initially kept low and column C1 is found
low during scanning, that means key ‘1’ is pressed.
12
Input
O
U
T
P
U
T
Case 1:
Case 2:
 5v is individually connected to all keys
13
 Initially keep all values as 1.
Input
O
U
T
P
U
T
14
Input
O
U
T
P
U
T
 ROW1 And COLUMN1 IS PRESSED THE KEY IS ‘1’
(R1,C1)
15
Interfacing Keypad with 8051
16
Key Identification
17
COLUMN SCANNING
INPUT ROW - PORT 1.3 to 1.0
R4 to R1
8051
R1=0
INPUT =1110= EH
C1=0: 1110=EH; Display = ‘1’
C2=0: 1101=DH; Display = ‘2’
C3=0: 1011=BH ;Display = ‘3’
C4=0: 0111=7H ;Display = ‘A’
COLUMN OUTPUT
PORT 1.7 to 1.4
C4 to C1
18
COLUMN SCANNING
INPUT ROW - PORT 1.3 to 1.0
R4 to R1
8051
R2=0
INPUT =1101= DH
C1=0: 1110=EH ;Display = ‘4’
C2=0: 1101=DH ;Display = ‘5’
C3=0: 1011=BH ;Display = ‘6’
C4=0: 0111=7H ;Display = ‘B’
COLUMN OUTPUT
PORT 1.7 to 1.4
C4 to C1
19
COLUMN SCANNING
INPUT ROW - PORT 1.3 to 1.0
R4 to R1
8051
R3=0
INPUT =1011= BH
COLUMN OUTPUT
PORT 1.7 to 1.4
C4 to C1
C1=0: 1110=EH;Display= ‘7’
C2=0: 1101=DH;Display= ‘8’
C3=0: 1011=BH;Display= ‘9’
C4=0: 0111=7H;Display= ‘C’
20
COLUMN SCANNING
INPUT ROW - PORT 1.3 to 1.0
R4 to R1
8051
R4=0
INPUT =0111= 7H
COLUMN OUTPUT
PORT 1.7 to 1.4
C4 to C1
C1=0: 1110=EH;Display= ‘E’
C2=0: 1101=DH;Display= ‘0’
C3=0: 1011=BH;Display= ‘F’
C4=0: 0111=7H;Display= ‘D’
21
ASCII LOOK UP TABLE FOR ROW( COLUMN SCANNING)
ORG 300H
Code1: DB ‘0’, ‘1’, ‘2’, ‘A’ ; Row1
Code2: DB ‘4’, ‘5’, ‘6’, ‘B’ ; Row2
Code3: DB ‘7’, ‘8’, ‘9’, ‘C’ ; Row3
Code4: DB ‘E’, ‘0’, ‘E’,‘D’ ; Row4
(OR)
22
Digit A B C D E F G DP
0 1 1 1 1 1 1 0 0
1 0 1 1 0 0 0 0 0
2 1 1 0 1 1 0 1 0
3 1 1 1 1 0 0 1 0
4 0 1 1 0 0 1 1 0
5 1 0 1 1 0 1 1 0
6 1 0 1 1 1 1 1 0
7 1 1 1 0 0 0 0 0
8 1 1 1 1 1 1 1 0
9 1 1 1 1 0 1 1 0
ASCII LOOK UP TABLE FOR ROW( COLUMN SCANNING)
23
Digit A B C D E F G DP
A 1 1 1 0 1 1 1 0
B 0 0 1 1 1 1 1 0
C 1 0 0 1 1 1 0 0
D 0 1 1 1 1 0 1 0
E 1 0 0 1 1 1 1 0
F 1 0 0 0 1 1 1 0
24
LUT:
DB 0 1 1 0 0 0 0 0
DB 1 1 0 1 1 0 1 0
DB 1 1 1 1 0 0 1 0
DB 1 1 1 0 1 1 1 0
DB 0 1 1 0 0 1 1 0
DB 1 0 1 1 0 1 1 0
DB 1 0 1 1 1 1 1 0
DB 0 0 1 1 1 1 1 0
DISPLAY OF LCD DEVICE
 Label DB can be called as a Look Up Table (LUT).
 Label DB is known as Define Byte – which defines 8 Bit.
25
DB 1 1 1 0 0 0 0 0
DB 1 1 1 1 1 1 1 0
DB 1 1 1 1 0 1 1 0
DB 1 0 0 1 1 1 0 0
DB 1 0 0 1 1 1 1 0
DB 1 1 1 1 1 1 0 0
DB 1 0 0 0 1 1 1 0
DB 0 1 1 1 1 0 1 0
26
1. Initializes PORT 0 as an output port by writing all 0’s to
it
2. PORT 1 as an input port by writing all 1’s to it.
3. Then make Row 1 ‘Low’ by clearing P1.0 and scan the
columns one by one for low using JB instruction.
4. If column C1 is found ‘Low’, that means KEY ‘1’ is
pressed.
5. Accumulator is loaded by zero (A=0) and DISPLAY
subroutine is called.
ABOUT THE PROGRAM
27
6. The display subroutine adds the content in A with the
starting address of LUT stored in DPTR (A+DPTR).
7. Load A with the data to which the resultant address
points (using instruction MOVC A,@A+DPTR).
8. The present data in A will be the digit drive pattern for
the current key press.
9. This pattern is put to Port 0 for display.
10. This way the program scans for each key one by one
and puts it on the display if it is found to be pressed.
28
PROGRAM:
ORG 00H
MOV DPTR,#LUT ; moves starting address of LUT to DPTR
MOV A,#11111111B ; loads A with all 1's
MOV P0,#00000000B ; initializes P0 as output port
BACK: MOV P1,#11111111B ;loads P1 with all 1's
CLR P1.0 ;makes row 1 low
JB P1.4,NEXT1 ;checks whether column 1 is low and
//jumps to NEXT1 if not low
MOV A,#0D ; loads a with 0D if column is low (that
//means key 1 is pressed)
ACALL DISPLAY ;calls DISPLAY subroutine
NEXT1: JB P1.5,NEXT2 ; checks whether column 2 is
// low and so on...
MOV A,#1D
ACALL DISPLAY
29
NEXT2: JB P1.6,NEXT3
MOV A,#2D
ACALL DISPLAY
NEXT3: JB P1.7,NEXT4
MOV A,#3D
ACALL DISPLAY
NEXT4: SETB P1.0
CLR P1.1
JB P1.4,NEXT5
MOV A,#4D
ACALL DISPLAY
NEXT5: JB P1.5,NEXT6
MOV A,#5D
ACALL DISPLAY
30
NEXT6: JB P1.6,NEXT7
MOV A,#6D
ACALL DISPLAY
NEXT7: JB P1.7,NEXT8
MOV A,#7D
ACALL DISPLAY
NEXT8: SETB P1.1
CLR P1.2
JB P1.4,NEXT9
MOV A,#8D
ACALL DISPLAY
NEXT9: JB P1.5,NEXT10
MOV A,#9D
ACALL DISPLAY
31
NEXT10: JB P1.6,NEXT11
MOV A,#10D
ACALL DISPLAY
NEXT11: JB P1.7,NEXT12
MOV A,#11D
ACALL DISPLAY
NEXT12: SETB P1.2
CLR P1.3
JB P1.4,NEXT13
MOV A,#12D
ACALL DISPLAY
NEXT13: JB P1.5,NEXT14
MOV A,#13D
ACALL DISPLAY
32
NEXT14: JB P1.6,NEXT15
MOV A,#14D
ACALL DISPLAY
NEXT15: JB P1.7,BACK
MOV A,#15D
ACALL DISPLAY
LJMP BACK
DISPLAY: MOVC A,@A+DPTR ; gets digit drive pattern for
//the current key from LUT
MOV P0,A ;puts corresponding digit drive
//pattern into P0
RET
33
LUT:
DB 01100000B // Look up table starts here
DB 11011010B
DB 11110010B
DB 11101110B
DB 01100110B
DB 10110110B
DB 10111110B
DB 00111110B
DB 11100000B
DB 11111110B
DB 11110110B
DB 10011100B
DB 10011110B
DB 11111100B
DB 10001110B
DB 01111010B
END
34
35
36

More Related Content

What's hot

8051 basic programming
8051 basic programming8051 basic programming
8051 basic programmingANJUSHA R
 
I o ports and timers of 8051
I o ports and timers of 8051I o ports and timers of 8051
I o ports and timers of 8051SARITHA REDDY
 
Microcontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMicrocontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMitesh Kumar
 
8051 assembly programming
8051 assembly programming8051 assembly programming
8051 assembly programmingsergeiseq
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypadPRADEEP
 
Embedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingEmbedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingIkhwan_Fakrudin
 
Embedded systems io programming
Embedded systems   io programmingEmbedded systems   io programming
Embedded systems io programmingimtiazalijoono
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Sivaranjan Goswami
 

What's hot (17)

8051 i/o port circuit
8051 i/o port circuit8051 i/o port circuit
8051 i/o port circuit
 
8051 basic programming
8051 basic programming8051 basic programming
8051 basic programming
 
3 jump, loop and call instructions
3 jump, loop and call instructions3 jump, loop and call instructions
3 jump, loop and call instructions
 
8279 d
8279 d8279 d
8279 d
 
I o ports and timers of 8051
I o ports and timers of 8051I o ports and timers of 8051
I o ports and timers of 8051
 
input
inputinput
input
 
8051 ports
8051 ports8051 ports
8051 ports
 
Microcontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMicrocontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumar
 
8051 assembly programming
8051 assembly programming8051 assembly programming
8051 assembly programming
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypad
 
6 arithmetic logic inst and prog
6 arithmetic logic inst and prog6 arithmetic logic inst and prog
6 arithmetic logic inst and prog
 
5 addressing modes
5 addressing modes5 addressing modes
5 addressing modes
 
Interfacing LCD with 8051 Microcontroller
Interfacing LCD with 8051 MicrocontrollerInterfacing LCD with 8051 Microcontroller
Interfacing LCD with 8051 Microcontroller
 
Embedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingEmbedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programming
 
Embedded systems io programming
Embedded systems   io programmingEmbedded systems   io programming
Embedded systems io programming
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
 
int 21,16,09 h
int 21,16,09 hint 21,16,09 h
int 21,16,09 h
 

Similar to Microcontroller- An overview

Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2SANTIAGO PABLO ALBERTO
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterKatrina Little
 
WINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptx
WINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptxWINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptx
WINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptxSrinivasanUma1
 
1205 Ppi 8279
1205 Ppi 82791205 Ppi 8279
1205 Ppi 8279techbed
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.pptnotagain0712
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Basil John
 
Computer archi&mp
Computer archi&mpComputer archi&mp
Computer archi&mpMSc CST
 
Micro c lab6(lcd)
Micro c lab6(lcd)Micro c lab6(lcd)
Micro c lab6(lcd)Mashood
 
12 chapter06 math_instructions_fa14
12 chapter06 math_instructions_fa1412 chapter06 math_instructions_fa14
12 chapter06 math_instructions_fa14John Todora
 
Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892Nirav rathod
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085 vijaydeepakg
 
Applications of microcontroller(8051)
Applications of microcontroller(8051) Applications of microcontroller(8051)
Applications of microcontroller(8051) vijaydeepakg
 
Basic computer organization design
Basic computer organization designBasic computer organization design
Basic computer organization designndasharath
 

Similar to Microcontroller- An overview (20)

Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
Interfacing with LCD
Interfacing with LCDInterfacing with LCD
Interfacing with LCD
 
Expt 5 matrix.docx
Expt 5 matrix.docxExpt 5 matrix.docx
Expt 5 matrix.docx
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
 
WINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptx
WINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptxWINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptx
WINSEM2023-24_BECE204L_TH_VL2023240505625_2024-01-29_Reference-Material-I.pptx
 
1205 Ppi 8279
1205 Ppi 82791205 Ppi 8279
1205 Ppi 8279
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
 
8051 io interface
8051 io interface8051 io interface
8051 io interface
 
8051 FINIAL
8051 FINIAL8051 FINIAL
8051 FINIAL
 
Hex keypad
Hex keypadHex keypad
Hex keypad
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
 
Computer archi&mp
Computer archi&mpComputer archi&mp
Computer archi&mp
 
Micro c lab6(lcd)
Micro c lab6(lcd)Micro c lab6(lcd)
Micro c lab6(lcd)
 
11. Lecture.pdf
11. Lecture.pdf11. Lecture.pdf
11. Lecture.pdf
 
12 chapter06 math_instructions_fa14
12 chapter06 math_instructions_fa1412 chapter06 math_instructions_fa14
12 chapter06 math_instructions_fa14
 
Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
 
Applications of microcontroller(8051)
Applications of microcontroller(8051) Applications of microcontroller(8051)
Applications of microcontroller(8051)
 
Basic computer organization design
Basic computer organization designBasic computer organization design
Basic computer organization design
 

Recently uploaded

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Recently uploaded (20)

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 

Microcontroller- An overview

  • 1. M.SARASWATHI Associate Professor Department of ECE Panimalar Engineering College MICROCONTROLLER PROGRAMMING - AN OVERVIEW A Webinar on
  • 2. Contents 1. Why programming is important? 2. Input and Output devices for microcontroller 3. Application of Microcontroller 4. Interfacing Keypad with microcontroller 5. Keypad Matrix Scanning concept. 6. ALP for interfacing keypad with LCD. 2
  • 3. Why Programming is important? There are three types or levels of Programming Languages for 8051 Microcontroller. 1. Machine Language 2. Assembly Language 3. High-level Language Programming in the sense of Microcontrollers means writing a sequence of instructions to perform a predefined task. 3  Toys movement of Left, Right – both legs and hands is Predefined Task
  • 5. 1. Senior Application & Design Support Engineer (Peenya Loc) 600000 - 900000 INR P.A. 2. Hardware Design Engineer 160000 - 420000 INR P.A. 3. Embedded Software Design Engineer ₹ 3,00,000 - 8,00,000 P.A. 4. Senior Engineer - Embedded Development – Microcontroller/qt/c++ - Contactx 300000 - 600000 INR P.A. 5. Embedded Software Engineer Zettaone Technologies India Pvt. Ltd 300000 - 600000 INR P.A. JOB OPPORTUNITY Microcontroller Programming- Fresher Samples of South Indian companies 5
  • 6.  Assembly Language is a pseudo-English representation of the Machine Language.  The 8051 Microcontroller Assembly Language is a combination of English like words called Mnemonics and Hexadecimal codes.  It is also a low level language and requires extensive understanding of the architecture of the Microcontroller. Why Assembly Language? 6
  • 7.  The Programs written in Assembly gets executed faster and they occupy less memory.  With the help of Assembly Language, you can directly exploit all the features of a Microcontroller.  Using Assembly Language, you can have direct and accurate control of all the Microcontroller’s resources like I/O Ports, RAM, SFRs, etc.  Compared to High-level Languages, Assembly Language has less rules and restrictions. Advantage of Assembly Language Programming 7
  • 8. Input and Output devices for microcontroller 8
  • 10.  Hex key pad is essentially a collection of 16 keys arranged in the form of a 4×4 matrix.  Hex key pad usually have keys representing numeric 0 to 9 and characters A to F. HEX KEYPAD (or) 4x4 MATRIX 10
  • 11.  The hex keypad has 8 communication lines namely R1, R2, R3, R4, C1, C2, C3 and C4.  R1 to R4 represents the four rows.  C1 to C4 represents the four columns.  When a particular key is pressed the corresponding row and column to which the terminals of the key are connected gets shorted. 11
  • 12.  The program identifies which key is pressed by a method known as column scanning.  In this method a particular row is kept low (other rows are kept high) and the columns are checked for low.  If a particular column is found low then that means that the key connected between that column and the corresponding row (the row that is kept low) is been pressed. For example : If row R1 is initially kept low and column C1 is found low during scanning, that means key ‘1’ is pressed. 12
  • 13. Input O U T P U T Case 1: Case 2:  5v is individually connected to all keys 13
  • 14.  Initially keep all values as 1. Input O U T P U T 14
  • 15. Input O U T P U T  ROW1 And COLUMN1 IS PRESSED THE KEY IS ‘1’ (R1,C1) 15
  • 18. COLUMN SCANNING INPUT ROW - PORT 1.3 to 1.0 R4 to R1 8051 R1=0 INPUT =1110= EH C1=0: 1110=EH; Display = ‘1’ C2=0: 1101=DH; Display = ‘2’ C3=0: 1011=BH ;Display = ‘3’ C4=0: 0111=7H ;Display = ‘A’ COLUMN OUTPUT PORT 1.7 to 1.4 C4 to C1 18
  • 19. COLUMN SCANNING INPUT ROW - PORT 1.3 to 1.0 R4 to R1 8051 R2=0 INPUT =1101= DH C1=0: 1110=EH ;Display = ‘4’ C2=0: 1101=DH ;Display = ‘5’ C3=0: 1011=BH ;Display = ‘6’ C4=0: 0111=7H ;Display = ‘B’ COLUMN OUTPUT PORT 1.7 to 1.4 C4 to C1 19
  • 20. COLUMN SCANNING INPUT ROW - PORT 1.3 to 1.0 R4 to R1 8051 R3=0 INPUT =1011= BH COLUMN OUTPUT PORT 1.7 to 1.4 C4 to C1 C1=0: 1110=EH;Display= ‘7’ C2=0: 1101=DH;Display= ‘8’ C3=0: 1011=BH;Display= ‘9’ C4=0: 0111=7H;Display= ‘C’ 20
  • 21. COLUMN SCANNING INPUT ROW - PORT 1.3 to 1.0 R4 to R1 8051 R4=0 INPUT =0111= 7H COLUMN OUTPUT PORT 1.7 to 1.4 C4 to C1 C1=0: 1110=EH;Display= ‘E’ C2=0: 1101=DH;Display= ‘0’ C3=0: 1011=BH;Display= ‘F’ C4=0: 0111=7H;Display= ‘D’ 21
  • 22. ASCII LOOK UP TABLE FOR ROW( COLUMN SCANNING) ORG 300H Code1: DB ‘0’, ‘1’, ‘2’, ‘A’ ; Row1 Code2: DB ‘4’, ‘5’, ‘6’, ‘B’ ; Row2 Code3: DB ‘7’, ‘8’, ‘9’, ‘C’ ; Row3 Code4: DB ‘E’, ‘0’, ‘E’,‘D’ ; Row4 (OR) 22
  • 23. Digit A B C D E F G DP 0 1 1 1 1 1 1 0 0 1 0 1 1 0 0 0 0 0 2 1 1 0 1 1 0 1 0 3 1 1 1 1 0 0 1 0 4 0 1 1 0 0 1 1 0 5 1 0 1 1 0 1 1 0 6 1 0 1 1 1 1 1 0 7 1 1 1 0 0 0 0 0 8 1 1 1 1 1 1 1 0 9 1 1 1 1 0 1 1 0 ASCII LOOK UP TABLE FOR ROW( COLUMN SCANNING) 23
  • 24. Digit A B C D E F G DP A 1 1 1 0 1 1 1 0 B 0 0 1 1 1 1 1 0 C 1 0 0 1 1 1 0 0 D 0 1 1 1 1 0 1 0 E 1 0 0 1 1 1 1 0 F 1 0 0 0 1 1 1 0 24
  • 25. LUT: DB 0 1 1 0 0 0 0 0 DB 1 1 0 1 1 0 1 0 DB 1 1 1 1 0 0 1 0 DB 1 1 1 0 1 1 1 0 DB 0 1 1 0 0 1 1 0 DB 1 0 1 1 0 1 1 0 DB 1 0 1 1 1 1 1 0 DB 0 0 1 1 1 1 1 0 DISPLAY OF LCD DEVICE  Label DB can be called as a Look Up Table (LUT).  Label DB is known as Define Byte – which defines 8 Bit. 25
  • 26. DB 1 1 1 0 0 0 0 0 DB 1 1 1 1 1 1 1 0 DB 1 1 1 1 0 1 1 0 DB 1 0 0 1 1 1 0 0 DB 1 0 0 1 1 1 1 0 DB 1 1 1 1 1 1 0 0 DB 1 0 0 0 1 1 1 0 DB 0 1 1 1 1 0 1 0 26
  • 27. 1. Initializes PORT 0 as an output port by writing all 0’s to it 2. PORT 1 as an input port by writing all 1’s to it. 3. Then make Row 1 ‘Low’ by clearing P1.0 and scan the columns one by one for low using JB instruction. 4. If column C1 is found ‘Low’, that means KEY ‘1’ is pressed. 5. Accumulator is loaded by zero (A=0) and DISPLAY subroutine is called. ABOUT THE PROGRAM 27
  • 28. 6. The display subroutine adds the content in A with the starting address of LUT stored in DPTR (A+DPTR). 7. Load A with the data to which the resultant address points (using instruction MOVC A,@A+DPTR). 8. The present data in A will be the digit drive pattern for the current key press. 9. This pattern is put to Port 0 for display. 10. This way the program scans for each key one by one and puts it on the display if it is found to be pressed. 28
  • 29. PROGRAM: ORG 00H MOV DPTR,#LUT ; moves starting address of LUT to DPTR MOV A,#11111111B ; loads A with all 1's MOV P0,#00000000B ; initializes P0 as output port BACK: MOV P1,#11111111B ;loads P1 with all 1's CLR P1.0 ;makes row 1 low JB P1.4,NEXT1 ;checks whether column 1 is low and //jumps to NEXT1 if not low MOV A,#0D ; loads a with 0D if column is low (that //means key 1 is pressed) ACALL DISPLAY ;calls DISPLAY subroutine NEXT1: JB P1.5,NEXT2 ; checks whether column 2 is // low and so on... MOV A,#1D ACALL DISPLAY 29
  • 30. NEXT2: JB P1.6,NEXT3 MOV A,#2D ACALL DISPLAY NEXT3: JB P1.7,NEXT4 MOV A,#3D ACALL DISPLAY NEXT4: SETB P1.0 CLR P1.1 JB P1.4,NEXT5 MOV A,#4D ACALL DISPLAY NEXT5: JB P1.5,NEXT6 MOV A,#5D ACALL DISPLAY 30
  • 31. NEXT6: JB P1.6,NEXT7 MOV A,#6D ACALL DISPLAY NEXT7: JB P1.7,NEXT8 MOV A,#7D ACALL DISPLAY NEXT8: SETB P1.1 CLR P1.2 JB P1.4,NEXT9 MOV A,#8D ACALL DISPLAY NEXT9: JB P1.5,NEXT10 MOV A,#9D ACALL DISPLAY 31
  • 32. NEXT10: JB P1.6,NEXT11 MOV A,#10D ACALL DISPLAY NEXT11: JB P1.7,NEXT12 MOV A,#11D ACALL DISPLAY NEXT12: SETB P1.2 CLR P1.3 JB P1.4,NEXT13 MOV A,#12D ACALL DISPLAY NEXT13: JB P1.5,NEXT14 MOV A,#13D ACALL DISPLAY 32
  • 33. NEXT14: JB P1.6,NEXT15 MOV A,#14D ACALL DISPLAY NEXT15: JB P1.7,BACK MOV A,#15D ACALL DISPLAY LJMP BACK DISPLAY: MOVC A,@A+DPTR ; gets digit drive pattern for //the current key from LUT MOV P0,A ;puts corresponding digit drive //pattern into P0 RET 33
  • 34. LUT: DB 01100000B // Look up table starts here DB 11011010B DB 11110010B DB 11101110B DB 01100110B DB 10110110B DB 10111110B DB 00111110B DB 11100000B DB 11111110B DB 11110110B DB 10011100B DB 10011110B DB 11111100B DB 10001110B DB 01111010B END 34
  • 35. 35
  • 36. 36