SlideShare a Scribd company logo
1 of 34
Microprocessor
8255- Programming
Dr.V.Jeyalakshmi.,
Professor/ECE
CEG, Anna University, Chennai
content
• Program to interface keys and display devices
• Program to initialize the BSR word
8255
CS
A1
A0
RD
WR
A7
A6
A5
A4
A3
A2 A1
A0
IOR
IOW Reset
Reset
Port A=80H
Control Register=83H
Port B=81H
Port C=82H
Do-D7
Do-D7
A7 A6 A5 A4 A3 A2 A1 A0
1 0 0 0 0 0 0 0 = 80H = Port A
0 1 = 81H = Port B
1 0 = 82H = Port C
1 1 = 83H = Control Register
Program 1
• Write a program to set Port A as input port
and set Port B as output port in mode1 of
8255
• Steps:
• Initialize the control word for Port A as input and
Port B as output in Mode1
• Calculate the port address for Port A, Port B and
Control register
• Select the instruction for Read and write operation
• Control Word
• D7 D6D5D4 D3 D2D1D0
1 0 1 1 0 1 0 0
B 4 = 84H
• Port address
Port A – 80H
Port B – 81H
Port C – 82H
Control register – 83H
I/O Mode
I/O Mode
• Program
MVI A, B4H -- Control Word
OUT 83H -- Control Register port Address
IN 80H -- Port A address
OUT 81H -- Port B address
HLT
Program 2
• Write a program to read DIP switches from
Group B and display the value in Group A in
mode0
Steps
• Calculate the port address
• Initialize the Control word
• Do the read and write operation
8255
CS
A1
A0
RD
WR
A7
A6
A5
A4
A3
A2
A1
A0
IOR
IOW
Reset
Reset
Buffer
Buffer
+5V
+5V
PA7
PA0
PC7
PC4
PC3
PC0
PB7
PB0
80H
82H
82H
81H
Do-D7
Do-D7
• Control Word
• D7 D6D5D4D3 D2D1D0
1 0 0 0 0 0 1 1
8 3 = 83H
• Program
MVI A, 83H -- Control Word
OUT 83H -- Control Register port Address
IN 81H -- Port B address
OUT 80H -- Port A address
IN 82H -- Port C address
ANI OFH – Mask the upper four bits
RLC
RLC convert upper 4 bits to lower 4 bits (nibbles)
RLC PCU PCL
RLC
OUT 82H -- Port C address
HLT
Program 3
• Write the program to clear the PC3 and set
PC6 of 8255.
Steps:
• Calculate the port address
• Write BSR control word to set PC3 and to
clear PC6
• Select the write operation
• BSR Control Word to clear PC3
D7 D6D5D4 D3D2D1 D0
0 0 0 0 0 1 1 0
0 6 = 06H
• BSR Control Word to set PC6
D7 D6D5D4 D3D2D1 D0
0 0 0 0 1 1 0 1
0 D = 0DH
• Program
MVI A, 06H -- Control Word to clear PC3
OUT 83H -- Control Register port Address
MVI A, ODH -- Control Word to set PC6
OUT 83H -- Control Register port Address
HLT
Review of Importance
• The main function of Control word and the
BSR were implemented with the simple
programming. How to get the value from the
Keys or switches and how to store and
display in LEDs were discussed with simple
example programs. The calculation of port
addresses from the interfacing and the bit set
or reset of PortC illustrated with simple
program
Questions
• Write the control word to set all ports as
input port in mode0
• Write the program to read the data from
portC upper to lower
• Write the BSR to set the 4,5,6 bit position of
portC
Synopsis
• The initialization of Control word and the BSR
control word were implemented with the
simple programming. The processor
interfaced with peripherals like the input
devices (switch or key) were read and the
some data were written into the output
device (LEDs) executed with programming.
The calculation of port addresses from the
interfacing and how to use in the program
were discussed.
Keywords
• Control word
• BSR control word
• Port address
• Program
Program 4
• Write a program to set PC4 for 4 ms and then
reset the bit in 8255
Steps:
• Calculate the port address
• Write the BSR word
• Do the write operation
• Set count value for 4ms
• BSR Control Word to set PC4
D7 D6D5D4 D3D2D1 D0
0 0 0 0 1 0 0 1
0 9 = 09H
• Program
MVI A, 09H -- BSR Word to set PC4
OUT 83H -- Control Register port Address
CALL Delay – delay for 2ms
MVI A, O8H -- BSR Word to clear PC4
OUT 83H -- Control Register port Address
HLT
Delay program
MVI C,
L1 DCR C
JNZ L1
RET
PROGRAM 5
Design a counter with 2 ms delay and set port B
to display the value.
Steps:
• Calculate the port address
• Write the control word
• Do the write operation
• Set count value for 2ms
• Program
MVI A, 80H -- Control Word
OUT 83H -- Control Register port Address
MVI B, OAH -- initialize the counter value
L1 MOV A,B
OUT 81H -- Port B address
CALL DELAY -- Delay for 2 ms
DCR B -- for next counter value
JNZ L1
HLT -- stop the program
DELAY
LXI B, 011EH -- initialize the delay/ counter value
L2 DCX B
MOV A,C -- decrement till zero
ORA B
JNZ L2
RET
Time delay
• Delay program for 8 bit
MVI C, FFH 7T TO
LOOP DCR C 4T
JNZ LOOP 10T TL = 14T
• Time Delay (Td) = [To +(TL *N10)-3]T
= [ 7 +(14 *255)-3] 0.5 *10-6
= 1792µsec
Time delay
• Delay program for 16 bit
LXI B,FFFFH 10 T TO
LOOP DCX B 6T TL = 24T
MOV A,C 4T
ORA B 4T
JNZ LOOP 10T
• Time Delay (Td) = [To +(TL *N10)-3]T
= [ 10 +(24 *65535)-3] 0.5 *10-6
= 78642µsec
• Time delay for 2ms
Time Delay (Td) = [To +(TL *N10)-3]T
2ms = [ 10+(24 *N10) -3]*0.5* 10-6
N10 = 2 * 10-3 -20 +3
0.5* 10-6 24
= 165 = A5H
• Time delay for 3ms
Time Delay (Td) = [To +(TL *N10)-3]T
3ms = [ 10+(24 *N10) -3]*0.5* 10-6
N10 = 3 * 10-3 -10 +3
0.5* 10-6 24
= 249 = F9H
• Time delay for 2ms
Time Delay (Td) = [To +(TL *N10)-3]T
2ms = [ 7+(14 *N10) -3]*0.5* 10-6
N10 = 2 * 10-3 -7 +3
0.5* 10-6 14
= 165 = A5H

More Related Content

What's hot

Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085Nitin Ahire
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148Veera Kumar
 
8086 Microprocessor powerpoint
8086  Microprocessor  powerpoint8086  Microprocessor  powerpoint
8086 Microprocessor powerpointRandhir Kumar
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adcPRADEEP
 
T-states in microprocessor 8085
T-states in microprocessor 8085T-states in microprocessor 8085
T-states in microprocessor 8085yedles
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085saleForce
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Ganesh Ram
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architectureDominicHendry
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architectureDr.YNM
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor Mustapha Fatty
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 MicroprocessorNahian Ahmed
 

What's hot (20)

Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148
 
8086 Microprocessor powerpoint
8086  Microprocessor  powerpoint8086  Microprocessor  powerpoint
8086 Microprocessor powerpoint
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
 
T-states in microprocessor 8085
T-states in microprocessor 8085T-states in microprocessor 8085
T-states in microprocessor 8085
 
Memory interfacing of microprocessor 8085
Memory interfacing of microprocessor 8085Memory interfacing of microprocessor 8085
Memory interfacing of microprocessor 8085
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architecture
 
IEEE-488
IEEE-488IEEE-488
IEEE-488
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architecture
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacing
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
 
Interfacing 8255
Interfacing 8255Interfacing 8255
Interfacing 8255
 
Unit 3 mpmc
Unit 3 mpmcUnit 3 mpmc
Unit 3 mpmc
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
 

Similar to 8255 programming

Similar to 8255 programming (20)

Lec14
Lec14Lec14
Lec14
 
L4-L6 8255 A.pptx
L4-L6 8255 A.pptxL4-L6 8255 A.pptx
L4-L6 8255 A.pptx
 
8155 GPPI
8155 GPPI8155 GPPI
8155 GPPI
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Lec12
Lec12Lec12
Lec12
 
8085 microprocessor(1)
8085 microprocessor(1)8085 microprocessor(1)
8085 microprocessor(1)
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)
 
Lec11
Lec11Lec11
Lec11
 
8255
82558255
8255
 
8085 instructions and addressing modes
8085 instructions and addressing modes8085 instructions and addressing modes
8085 instructions and addressing modes
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent
 
knowledge in daily life.ppt
knowledge in daily life.pptknowledge in daily life.ppt
knowledge in daily life.ppt
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
 
26. 8255 control word programming
26. 8255 control word programming26. 8255 control word programming
26. 8255 control word programming
 
Lec04
Lec04Lec04
Lec04
 
Lec04
Lec04Lec04
Lec04
 
8255 presentaion.ppt
8255 presentaion.ppt8255 presentaion.ppt
8255 presentaion.ppt
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
 
Interfacing with Timer IC.pptx interfacing with timer ic
Interfacing with Timer IC.pptx interfacing with timer icInterfacing with Timer IC.pptx interfacing with timer ic
Interfacing with Timer IC.pptx interfacing with timer ic
 
MICROCONTROLLER.pptx
MICROCONTROLLER.pptxMICROCONTROLLER.pptx
MICROCONTROLLER.pptx
 

Recently uploaded

Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
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
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
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
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
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
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
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
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
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
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
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
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 

Recently uploaded (20)

Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
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
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
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
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
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
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
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
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
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
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
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
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 

8255 programming

  • 2. content • Program to interface keys and display devices • Program to initialize the BSR word
  • 3. 8255 CS A1 A0 RD WR A7 A6 A5 A4 A3 A2 A1 A0 IOR IOW Reset Reset Port A=80H Control Register=83H Port B=81H Port C=82H Do-D7 Do-D7 A7 A6 A5 A4 A3 A2 A1 A0 1 0 0 0 0 0 0 0 = 80H = Port A 0 1 = 81H = Port B 1 0 = 82H = Port C 1 1 = 83H = Control Register
  • 4. Program 1 • Write a program to set Port A as input port and set Port B as output port in mode1 of 8255 • Steps: • Initialize the control word for Port A as input and Port B as output in Mode1 • Calculate the port address for Port A, Port B and Control register • Select the instruction for Read and write operation
  • 5. • Control Word • D7 D6D5D4 D3 D2D1D0 1 0 1 1 0 1 0 0 B 4 = 84H
  • 6. • Port address Port A – 80H Port B – 81H Port C – 82H Control register – 83H
  • 9. • Program MVI A, B4H -- Control Word OUT 83H -- Control Register port Address IN 80H -- Port A address OUT 81H -- Port B address HLT
  • 10. Program 2 • Write a program to read DIP switches from Group B and display the value in Group A in mode0 Steps • Calculate the port address • Initialize the Control word • Do the read and write operation
  • 12. • Control Word • D7 D6D5D4D3 D2D1D0 1 0 0 0 0 0 1 1 8 3 = 83H
  • 13. • Program MVI A, 83H -- Control Word OUT 83H -- Control Register port Address IN 81H -- Port B address OUT 80H -- Port A address IN 82H -- Port C address ANI OFH – Mask the upper four bits RLC RLC convert upper 4 bits to lower 4 bits (nibbles) RLC PCU PCL RLC OUT 82H -- Port C address HLT
  • 14. Program 3 • Write the program to clear the PC3 and set PC6 of 8255. Steps: • Calculate the port address • Write BSR control word to set PC3 and to clear PC6 • Select the write operation
  • 15. • BSR Control Word to clear PC3 D7 D6D5D4 D3D2D1 D0 0 0 0 0 0 1 1 0 0 6 = 06H
  • 16. • BSR Control Word to set PC6 D7 D6D5D4 D3D2D1 D0 0 0 0 0 1 1 0 1 0 D = 0DH
  • 17. • Program MVI A, 06H -- Control Word to clear PC3 OUT 83H -- Control Register port Address MVI A, ODH -- Control Word to set PC6 OUT 83H -- Control Register port Address HLT
  • 18. Review of Importance • The main function of Control word and the BSR were implemented with the simple programming. How to get the value from the Keys or switches and how to store and display in LEDs were discussed with simple example programs. The calculation of port addresses from the interfacing and the bit set or reset of PortC illustrated with simple program
  • 19. Questions • Write the control word to set all ports as input port in mode0 • Write the program to read the data from portC upper to lower • Write the BSR to set the 4,5,6 bit position of portC
  • 20. Synopsis • The initialization of Control word and the BSR control word were implemented with the simple programming. The processor interfaced with peripherals like the input devices (switch or key) were read and the some data were written into the output device (LEDs) executed with programming. The calculation of port addresses from the interfacing and how to use in the program were discussed.
  • 21. Keywords • Control word • BSR control word • Port address • Program
  • 22. Program 4 • Write a program to set PC4 for 4 ms and then reset the bit in 8255 Steps: • Calculate the port address • Write the BSR word • Do the write operation • Set count value for 4ms
  • 23. • BSR Control Word to set PC4 D7 D6D5D4 D3D2D1 D0 0 0 0 0 1 0 0 1 0 9 = 09H
  • 24. • Program MVI A, 09H -- BSR Word to set PC4 OUT 83H -- Control Register port Address CALL Delay – delay for 2ms MVI A, O8H -- BSR Word to clear PC4 OUT 83H -- Control Register port Address HLT
  • 25. Delay program MVI C, L1 DCR C JNZ L1 RET
  • 26. PROGRAM 5 Design a counter with 2 ms delay and set port B to display the value. Steps: • Calculate the port address • Write the control word • Do the write operation • Set count value for 2ms
  • 27. • Program MVI A, 80H -- Control Word OUT 83H -- Control Register port Address MVI B, OAH -- initialize the counter value L1 MOV A,B OUT 81H -- Port B address CALL DELAY -- Delay for 2 ms DCR B -- for next counter value JNZ L1 HLT -- stop the program DELAY LXI B, 011EH -- initialize the delay/ counter value L2 DCX B MOV A,C -- decrement till zero ORA B JNZ L2 RET
  • 28. Time delay • Delay program for 8 bit MVI C, FFH 7T TO LOOP DCR C 4T JNZ LOOP 10T TL = 14T
  • 29. • Time Delay (Td) = [To +(TL *N10)-3]T = [ 7 +(14 *255)-3] 0.5 *10-6 = 1792µsec
  • 30. Time delay • Delay program for 16 bit LXI B,FFFFH 10 T TO LOOP DCX B 6T TL = 24T MOV A,C 4T ORA B 4T JNZ LOOP 10T
  • 31. • Time Delay (Td) = [To +(TL *N10)-3]T = [ 10 +(24 *65535)-3] 0.5 *10-6 = 78642µsec
  • 32. • Time delay for 2ms Time Delay (Td) = [To +(TL *N10)-3]T 2ms = [ 10+(24 *N10) -3]*0.5* 10-6 N10 = 2 * 10-3 -20 +3 0.5* 10-6 24 = 165 = A5H
  • 33. • Time delay for 3ms Time Delay (Td) = [To +(TL *N10)-3]T 3ms = [ 10+(24 *N10) -3]*0.5* 10-6 N10 = 3 * 10-3 -10 +3 0.5* 10-6 24 = 249 = F9H
  • 34. • Time delay for 2ms Time Delay (Td) = [To +(TL *N10)-3]T 2ms = [ 7+(14 *N10) -3]*0.5* 10-6 N10 = 2 * 10-3 -7 +3 0.5* 10-6 14 = 165 = A5H