SlideShare a Scribd company logo
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
UNIT III 
Interfacing of Peripherals to Microcontrollers 
Programmable Peripheral Interface (PPI-8255): 
The Intel 8255 is a programmable peripheral interface (PPI). It has three 8-bit ports, namely 
Port A, Port B and Port C. The Port C has been further divided into two 4-bit ports, Port C lower 
and Port C upper. Thus, a total of 4 ports are available, two 8-bit ports and two 4-bit ports. Each 
port can be programmed either as an input port or an output port. 
Architecture of Intel 8255 : 
` 
Data Bus (D7-D0): 
The data pins of the 8255 are connected to the data pins of the microcontroller. These lines are 
used to send data back and forth between the controller and the 8255 chip. 
Chip Select (CS ): 
A low on this input selects the chip and enables the communication between the 8255 & the CPU. 
RD (Read) : 
A low on this pin enables the 8255 to send the data or status information to the CPU on the data 
bus. 
WR (Write) : 
A low on this pin enables the CPU to write data or control words into the 8255. 
A1, A0 port select lines: 
While CS selects the entire chip, A0 and A1 lines selects the specific port. 
CS A1 A0 Selection 
0 0 0 Port A 
0 0 1 Port B 
0 1 0 Port C 
1
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
0 1 1 Control Register 
1 x x 8255 is not selected 
RESET: 
A high on this pin clears the control register and all ports (A, B & C) are initialized as 
input ports. 
PORTA: 
It is an 8 bit port, can be programmed as either input or output port. It can also be used as a 
bidirectional port. 
PORT B: 
It is an 8 bit port, can be programmed as either input or output port. 
PORT C: 
It is an 8 bit port, can be programmed as either input or output port. This port is again divided into 
two 4-bit ports and each 4 bit port can be programmed individually. 
Interfacing of 8255 with 8051: 
In the 8051, Port 0 and Port 2 provide the 16-bit address to access external memory. 
Among these two ports, P0 provides the lower 8 bit addresses A0-A7 and P2 provides the upper 8 
bit addresses A8-A15. More importantly, P0 is also used to provide the 8-bit data bus D0-D7. In 
other words, pins P0.0 – P0.7 are used for both the address and data paths. This is called 
address/data multiplexing. To extract the addresses from the P0 pins, keep ALE=1 and connect a 
74LS373 D latch to P0. Data lines are directly taken from the P0 by keeping ALE=0 in 8051. Only 
A1 and A0 lines are used to select the ports of 8255. 
Fig: Interfacing of 8255 with 8051 
2
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
As shown in the diagram the P0.0 (A0) and P0.1 (A1) are used to select the ports of 
8255 and the remaining lines of P0.2- P0.7(A2-A7) are kept at 0. The P2 lines i.e., P2.0 to P2.6 
(A8 to A14) are kept at 0 and the remaining line P2.7 (A15) is connected to the CS line of 8255 
through a not gate. The P3.6 (WR ) and P3.7 ( RD) lines of P3 are connected to the WR and 
RD pins of 8255 respectively. 
According to the diagram, the addresses of Port A, Port B, Port C and control 
register are 8000H, 8001H, 8002H and 8003H respectively. By using these addresses a program is 
written for generating a square wave of 50 % duty cycle using PA0. 
MOV A,#80H ; Move control word to A 
MOV DPTR, #8003H ; Load control register address 
MOVX @DPTR, A ; Issue control word to control register 
MOV DPTR, #8000H ; DPTR points to Port A 
START: MOV A, #01H ; A=01H 
MOVX @DPTR,A ; PA0 =1 
ACALL DELAY ; Call a delay for the ON time 
MOV A,#00H ; A=00H 
MOVX @DPTR,A ; PA0 = 0 
ACALL DELAY ; Call delay for OFF time 
SJMP START ; Repeat to generate a continuous waveform 
Interfacing of ADC to the 8051 : 
An analog to digital converter is used to convert analog signals to digital quantity (binary 
word). The digital output is fed to the microcontroller for processing. The most popular method of 
analog to digital conversion is successive approximation method. A widely used ADC chip is 
ADC0809. 
Features of ADC 0809: 
· It is an 8-bit A/D converter with 8 channel analog multiplexer. 
· It is a National semiconductor make CMOS device. 
· It uses successive approximation as the conversion technique. 
· The device operates with single +5V power supply. 
· The conversion time is 100μs at 640 KHz. 
· The resolution is 8 bits 
3
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
· Error is ±1 LSB 
Interfacing diagram of ADC0809 with 8051: 
As shown in the diagram Port 1 of 8051 microcontroller is connected to the data lines of 
ADC0809. The address lines C, B, and A are grounded. So, Channel 0 is selected to apply the 
analog input. To deactivate the remaining channels, they are grounded. Vref(+), Vcc and OE all are 
connected to +5V. Vref (-) and GND pins are connected to ground. CLK must be applied to the 
10th pin of ADC by using a clock source. SOC line is used to start the conversion and ALE line is 
used to latch the address. To start the conversion and latch the address make these lines high 
through the microcontroller. Then conversion begins. After some time EOC line becomes high, to 
indicate the conversion is completed and the equivalent digital word is at Port 1. The timing 
diagram shows the entire procedure of analog to digital conversion. 
Fig: Timing diagram for ADC 0809 
4
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
Program: 
START: SETB P3.4 ; Set SOC = 1, ALE = 1 
ACALL DELAY ; Call for the delay 
CLR P3.4 ; Clear SOC and ALE 
HERE: JNB P3.5,HERE ; Check, for EOC = 1 
MOV A, P1 ; Move the data from Port 1 to A 
SJMP START ; Continue the same 
Result : 
Analog input in Volts Digital output in Hex 
0 
1 
2 
3 
4 
5 
00 
33 
66 
99 
CC 
FF 
Interfacing of DAC0800 with 8051 : 
Digital to analog converters are used to convert digital quantity to analog quantity. D/A converter 
produces an output proportional to the digital quantity (binary word) applied to its input. A most 
widely used DAC chip is DAC 0800. 
Features of DAC0800: 
· It is an 8-bit DAC 
· It has fast settling time : 100ns 
· The conversion technique used is R-2R ladder network method 
· It operates at +4.5V to +18V supply 
· Low cost 
· Full scale error: ±1 LSB 
· Low power consumption 
5
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
Interfacing diagram of DAC with 8051: 
As shown in the diagram Port 1of 8051 microcontroller is connected to the data lines of 
DAC. The supply V+ is connected to the +5V or +12V. V- is connected to the -12V. The DAC 
0800 is a current output device. So, an op-amp is used, to convert the output of DAC i.e., current to 
voltage. One of the applications of an op amp is as a current to voltage converter. The output of 
the op amp is the actual analog voltage, which is equivalent to the applied digital word through the 
microcontroller. 
Program: 
START: MOV A, #DATA ; Move the digital input to A 
MOV P1, A ; Move data 80H to Port 1 
SJMP START ; Continue the same 
Result : 
Digital input 
In Hex 
Analog output 
In volts 
00 
40 
80 
CC 
FF 
0 
2.5 
5 
7.5 
10 
6
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
Digital Data transmission : 
The transmission of binary data across a link can be accomplished either in parallel mode or 
serial mode. 
Parallel transmission : 
In parallel transmission, multiple bits are sent at a time. The advantage of parallel 
transmission is speed. But, the disadvantage of this parallel transmission is cost. Because, it 
requires n channels to transmit n bits. So, Parallel transmission is usually limited to short distances. 
Examples of parallel transmission include connections between a computer and a printer. 
Serial transmission : 
In serial transmission one bit follows another. It needs only one communication channel. 
The advantage of serial communication is cost. Examples of serial transmission include 
connections between a computer and a modem using the RS-232 protocol . 
Serial communication occurs in one of two ways : Asynchronous and Synchronous. 
7
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
Asynchronous transmission : 
In asynchronous transmission, the timing of the signal is unimportant. In asynchronous 
transmission, we send one start bit (0) at the beginning and one or more stop bits (1s) at the end of 
each byte. There may be a gap between each byte. 
Synchronous transmission : 
In synchronous transmission, timing is important. In synchronous transmission, we send 
bits one after another without start/stop bits or gaps. It is the responsibility of the receiver to group 
the bits. 
Serial Communication – Modes : 
The transmission mode is used to define the direction of signal flow between two devices. 
There are three types of transmission modes : Simplex, half-duplex and full duplex. 
Simplex Mode : 
In simplex mode, the communication is unidirectional, as on a one way street. Only one of 
the two stations on a link can transmit, the other can only receive. 
Keyboards and traditional monitors are both examples of simplex devices. The keyboard 
can only introduce input, the monitor can only accept output. 
8
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
Half-duplex Mode : 
In half-duplex mode, each station can both transmit and receive, but not at the same time. 
When one device is sending, the other can only receive, and vice versa. 
The half-duplex mode is like a one-lane road with two directional traffic. Walkie-talkies 
and CB (Citizen’s Band) radios are both half duplex systems. 
Full-duplex Mode : 
In full-duplex mode (also called duplex), both stations can transmit and receive 
simultaneously. 
The full-duplex mode is like a two way street with traffic flowing in both directions at the 
same time. One common example of full duplex communication is the telephone network. 
Serial Communication Protocols : 
A variety of communication protocols have been developed based on serial communication in the 
past few decades. Some of them are: 
1. RS-232 
2. RS-423 
3. RS-485 
4. RS422 
5. USB 
6. Fire Wire 
7. Ethernet 
8. MIDI 
9. PCI Express 
10. SPI & SCI 
11. I2C 
12. IrDA 
9
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
RS-232 – Recommended Standard 232: 
RS-232 has been a standard for decades as an electrical interface between Data Terminal 
Equipment (DTE) and Data Circuit-Terminating Equipment (DCE). A DTE is any device that is 
source or destination for binary data. A DCE is any device that transmits or receives data in the 
form of an analog or digital signal through a network. 
RS-232 is the oldest and most popular serial communication standard. RS232 stands for 
Recommended Standard number 232. It is developed by EIA (Electronics Industries Association) 
in 1960. It is the standard used in PCs and various types of equipment. It is used to connect only 
two devices. This RS232 standard defines the interface as a 25 wire cable with male and a female 
DB 25 pin connector attached to either end. The length of the cable may not exceed 15 meters (50 
feet). 
However, since the standard was set long before the advent of TTL logic family, its input 
and output voltage level are not TTL compatible. In RS232, a 1 bit is represented by -3 to -15V, 
while a 0 bit is represented by +3 to +15V, making -3 to +3 undefined. For this reason, to connect 
any RS232 to a microcontroller system , we must use voltage converters such as MAX 232 to 
convert the TTL logic levels to the RS232 voltage level, and vice-versa. 
8051 connection to RS232 : 
The 8051 has two pins that are used specifically for transferring and receiving data serially. 
These two pins are called TxD and RxD and are part of the port 3 (P3.0 and P3.1). Pin 11 of the 
8051 (P3.1) is assigned to TxD and pin 10 (P3.0) is designated as RxD. These pins are TTL 
compatible. Therefore, they require line driver to make them RS232 compatible. One such line 
driver is the MAX232 chip. 
10
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
The MAX232 has two sets of line drivers for transferring and receikving data. The line 
drivers used for TxD are called T1 and T2, while the line drivers for RxD are designated as R1 and 
R2. In many applications only one set is used. For example, T1 and R1 are used together for TxD 
and RxD of the 8051, and the second set is left unused. In MAX232 the T1 line driver has a 
designation of T1 in and T1 out on pin numbers 11 and 14, respectively. The T1 in pin is the TTL 
side and is connected to TxD of the microcontroller, while T1 out is the RS 232 side that is 
connected to the RxD pin of the RS232 DB connector. The R1 line driver has a designation of R1 
in and R1 out on pin numbers 13 and 12 respectively. The R1 in (pin 13) is the RS232 side that is 
connected to the TxD pin of the RS232 DB connector, and R1 out (pin 12) is the TTL side that is 
connected to the RxD pin of the microcontroller. 
RS-485 : 
RS-485 is an improved RS-422 with the capability to connect up to 16 devices (transceivers) 
on one serial bus to form a network. Such a network can have a "daisy chain" topology where each 
device is connected to two other devices except for the devices on the ends. Only one device may 
drive data onto the bus at a time. The standard does not specify the rules for deciding who transmits 
and when on such a network. That is up to the system designer to define. 
RS-423 : 
RS-423 is similar to RS-232C except that it allows for higher baud rates and longer cable 
lengths because it tolerates ground voltage differences between sender and receiver. The maximum 
signal voltage levels are ±6 volts. Ground voltage differences can occur in electrically noisy 
environments where heavy electrical machinery is operating. 
RS-422 : 
RS-422, like RS-232, is used to connect only two systems. It uses differential, or "double 
ended" data transmission, which means that data is transmitted simultaneously on two wires 
between two stations independent of the ground wire. Each signal requires 2 wires with a ground 
present in the system. The advantage of this method over RS-232 is higher speeds and longer cable 
lengths - 4000 feet at a 100K baud rate, for example. 
11
Dr. C. SARITHA 
DEPT. OF ELECTRONICS 
SPI – Serial Peripheral Interface: 
It is a three-wire based communication system. One wire each for Master to slave and Vice-versa, 
and one for clock pulses. There is an additional SS (Slave Select) line, which is mostly used 
when we want to send/receive data between multiple ICs. 
I2C – Inter-Integrated Circuit: 
Pronounced eye-two-see or eye-square-see, this is an advanced form of USART. The 
transmission speeds can be as high as a whopping 400KHz. The I2C bus has two wires – one for 
clock, and the other is the data line, which is bi-directional – this being the reason it is also 
sometimes (not always – there are a few conditions) called Two Wire Interface (TWI). It is a pretty 
new and revolutionary technology invented by Philips. 
FireWire : 
Developed by Apple, they are high-speed buses capable of audio/video transmission. The 
bus contains a number of wires depending upon the port, which can be either a 4-pin one, or a 6-pin 
one, or an 8-pin one. 
Ethernet: 
Used mostly in LAN connections, the bus consists of 8 lines, or 4 Tx/Rx pairs. 
Universal serial bus (USB): 
This is the most popular of all. Is used for virtually all type of connections. The bus has 4 
lines: VCC, Ground, Data+, and Data-. 
××××× 
12

More Related Content

What's hot (18)

PPT
Io (2)
Aisu
 
PDF
8085 lab
Nithin Mohan
 
PPT
8255 PPI (programmable Peripheral Interface) mode 0
ABHIMANYUJHA8
 
PPTX
8255 PPI or parallel interface
Akkenaguntla Karthik
 
PDF
Unit 5 assembly language programming
Kartik Sharma
 
PPTX
Interfacing of 8255 IC By Er. Swapnil Kaware.
Prof. Swapnil V. Kaware
 
DOCX
The 8255 PPI
Srikrishna Thota
 
DOC
Microprocessor Basics 8085-8255 ch-5
Neelam Kapoor
 
PPT
1204 Ppi 8255
techbed
 
PPT
Interfacing ics for microprocessor
THANDAIAH PRABU
 
PPT
Ppi 8255
Muhammadalizardari
 
PPT
8255 Introduction
Sharmila Chidaravalli
 
PPT
8255 class
riyasekaran
 
PPTX
8255_Ppi new
Monica Gunjal
 
PPTX
8255:ppi & 8259:pic
Adarsh Patel
 
PPT
Chapter
Manan Patel
 
PPTX
An application of 8085 register interfacing with LCD
Taha Malampatti
 
Io (2)
Aisu
 
8085 lab
Nithin Mohan
 
8255 PPI (programmable Peripheral Interface) mode 0
ABHIMANYUJHA8
 
8255 PPI or parallel interface
Akkenaguntla Karthik
 
Unit 5 assembly language programming
Kartik Sharma
 
Interfacing of 8255 IC By Er. Swapnil Kaware.
Prof. Swapnil V. Kaware
 
The 8255 PPI
Srikrishna Thota
 
Microprocessor Basics 8085-8255 ch-5
Neelam Kapoor
 
1204 Ppi 8255
techbed
 
Interfacing ics for microprocessor
THANDAIAH PRABU
 
8255 Introduction
Sharmila Chidaravalli
 
8255 class
riyasekaran
 
8255_Ppi new
Monica Gunjal
 
8255:ppi & 8259:pic
Adarsh Patel
 
Chapter
Manan Patel
 
An application of 8085 register interfacing with LCD
Taha Malampatti
 

Similar to Unit iii microcontrollers final1 (20)

PPTX
application of Mp traffic light LED LCD display.pptx
vaishnavipanditengg
 
PDF
analog to digital converter and dac final
DrVikasMahor
 
PDF
ADC and DAC interfacing.pdf
VikasMahor3
 
PPTX
FALLSEM2024-25_BEEE309L_TH_VL2024250101214_2024-10-05_Reference-Material-I.pptx
Rahultater4
 
PPTX
Analog to Digital Converters
Amitabh Shukla
 
DOC
Unit iv microcontrollers final
SARITHA REDDY
 
PPTX
8086 microprocessor -Input/Output INTERFACING
C.Helen Sulochana
 
PPT
Chapter5 dek3133
Hattori Sidek
 
PPTX
8255 PPI
deval patel
 
PPTX
Lica 7th chapter slides
SIVA NAGENDRA REDDY
 
PPTX
unit 2 microprocesor8085 for advantages disadvatage gtu syllabus.pptx
dravidparmar1
 
PPTX
2.instrumentation ii
Bikash Gyawali
 
PDF
Interfacing Analog to Digital Data Converters ee3404.pdf
ragupathi90
 
PPTX
8155 GPPI
deval patel
 
PPTX
adcPresentation for microcontrolling process techniq
shikhashrivastava27
 
PPTX
MicroProcessors and MicroControllersUnit3
deepakdmaat
 
PPTX
Unit-3 IO Interfacing-1.pptximportant questions to be noted
mandakalyan811
 
PDF
unit-3-8255.pdf
ShanmukhSaiR
 
PPTX
Interfacing technique with 8085- ADC[0808]
Guhan k
 
application of Mp traffic light LED LCD display.pptx
vaishnavipanditengg
 
analog to digital converter and dac final
DrVikasMahor
 
ADC and DAC interfacing.pdf
VikasMahor3
 
FALLSEM2024-25_BEEE309L_TH_VL2024250101214_2024-10-05_Reference-Material-I.pptx
Rahultater4
 
Analog to Digital Converters
Amitabh Shukla
 
Unit iv microcontrollers final
SARITHA REDDY
 
8086 microprocessor -Input/Output INTERFACING
C.Helen Sulochana
 
Chapter5 dek3133
Hattori Sidek
 
8255 PPI
deval patel
 
Lica 7th chapter slides
SIVA NAGENDRA REDDY
 
unit 2 microprocesor8085 for advantages disadvatage gtu syllabus.pptx
dravidparmar1
 
2.instrumentation ii
Bikash Gyawali
 
Interfacing Analog to Digital Data Converters ee3404.pdf
ragupathi90
 
8155 GPPI
deval patel
 
adcPresentation for microcontrolling process techniq
shikhashrivastava27
 
MicroProcessors and MicroControllersUnit3
deepakdmaat
 
Unit-3 IO Interfacing-1.pptximportant questions to be noted
mandakalyan811
 
unit-3-8255.pdf
ShanmukhSaiR
 
Interfacing technique with 8085- ADC[0808]
Guhan k
 
Ad

Recently uploaded (20)

PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PPTX
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PDF
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
PPTX
Connecting Linear and Angular Quantities in Human Movement.pptx
AngeliqueTolentinoDe
 
PDF
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
PPTX
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
PPTX
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
PDF
Andreas Schleicher_Teaching Compass_Education 2040.pdf
EduSkills OECD
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PDF
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
PPTX
grade 8 week 2 ict.pptx. matatag grade 7
VanessaTaberlo
 
PPTX
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
PDF
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PDF
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
PDF
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PPTX
MATH 8 QUARTER 1 WEEK 1 LESSON 2 PRESENTATION
JohnGuillerNestalBah1
 
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
Connecting Linear and Angular Quantities in Human Movement.pptx
AngeliqueTolentinoDe
 
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
Andreas Schleicher_Teaching Compass_Education 2040.pdf
EduSkills OECD
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
grade 8 week 2 ict.pptx. matatag grade 7
VanessaTaberlo
 
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
MATH 8 QUARTER 1 WEEK 1 LESSON 2 PRESENTATION
JohnGuillerNestalBah1
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Ad

Unit iii microcontrollers final1

  • 1. Dr. C. SARITHA DEPT. OF ELECTRONICS UNIT III Interfacing of Peripherals to Microcontrollers Programmable Peripheral Interface (PPI-8255): The Intel 8255 is a programmable peripheral interface (PPI). It has three 8-bit ports, namely Port A, Port B and Port C. The Port C has been further divided into two 4-bit ports, Port C lower and Port C upper. Thus, a total of 4 ports are available, two 8-bit ports and two 4-bit ports. Each port can be programmed either as an input port or an output port. Architecture of Intel 8255 : ` Data Bus (D7-D0): The data pins of the 8255 are connected to the data pins of the microcontroller. These lines are used to send data back and forth between the controller and the 8255 chip. Chip Select (CS ): A low on this input selects the chip and enables the communication between the 8255 & the CPU. RD (Read) : A low on this pin enables the 8255 to send the data or status information to the CPU on the data bus. WR (Write) : A low on this pin enables the CPU to write data or control words into the 8255. A1, A0 port select lines: While CS selects the entire chip, A0 and A1 lines selects the specific port. CS A1 A0 Selection 0 0 0 Port A 0 0 1 Port B 0 1 0 Port C 1
  • 2. Dr. C. SARITHA DEPT. OF ELECTRONICS 0 1 1 Control Register 1 x x 8255 is not selected RESET: A high on this pin clears the control register and all ports (A, B & C) are initialized as input ports. PORTA: It is an 8 bit port, can be programmed as either input or output port. It can also be used as a bidirectional port. PORT B: It is an 8 bit port, can be programmed as either input or output port. PORT C: It is an 8 bit port, can be programmed as either input or output port. This port is again divided into two 4-bit ports and each 4 bit port can be programmed individually. Interfacing of 8255 with 8051: In the 8051, Port 0 and Port 2 provide the 16-bit address to access external memory. Among these two ports, P0 provides the lower 8 bit addresses A0-A7 and P2 provides the upper 8 bit addresses A8-A15. More importantly, P0 is also used to provide the 8-bit data bus D0-D7. In other words, pins P0.0 – P0.7 are used for both the address and data paths. This is called address/data multiplexing. To extract the addresses from the P0 pins, keep ALE=1 and connect a 74LS373 D latch to P0. Data lines are directly taken from the P0 by keeping ALE=0 in 8051. Only A1 and A0 lines are used to select the ports of 8255. Fig: Interfacing of 8255 with 8051 2
  • 3. Dr. C. SARITHA DEPT. OF ELECTRONICS As shown in the diagram the P0.0 (A0) and P0.1 (A1) are used to select the ports of 8255 and the remaining lines of P0.2- P0.7(A2-A7) are kept at 0. The P2 lines i.e., P2.0 to P2.6 (A8 to A14) are kept at 0 and the remaining line P2.7 (A15) is connected to the CS line of 8255 through a not gate. The P3.6 (WR ) and P3.7 ( RD) lines of P3 are connected to the WR and RD pins of 8255 respectively. According to the diagram, the addresses of Port A, Port B, Port C and control register are 8000H, 8001H, 8002H and 8003H respectively. By using these addresses a program is written for generating a square wave of 50 % duty cycle using PA0. MOV A,#80H ; Move control word to A MOV DPTR, #8003H ; Load control register address MOVX @DPTR, A ; Issue control word to control register MOV DPTR, #8000H ; DPTR points to Port A START: MOV A, #01H ; A=01H MOVX @DPTR,A ; PA0 =1 ACALL DELAY ; Call a delay for the ON time MOV A,#00H ; A=00H MOVX @DPTR,A ; PA0 = 0 ACALL DELAY ; Call delay for OFF time SJMP START ; Repeat to generate a continuous waveform Interfacing of ADC to the 8051 : An analog to digital converter is used to convert analog signals to digital quantity (binary word). The digital output is fed to the microcontroller for processing. The most popular method of analog to digital conversion is successive approximation method. A widely used ADC chip is ADC0809. Features of ADC 0809: · It is an 8-bit A/D converter with 8 channel analog multiplexer. · It is a National semiconductor make CMOS device. · It uses successive approximation as the conversion technique. · The device operates with single +5V power supply. · The conversion time is 100μs at 640 KHz. · The resolution is 8 bits 3
  • 4. Dr. C. SARITHA DEPT. OF ELECTRONICS · Error is ±1 LSB Interfacing diagram of ADC0809 with 8051: As shown in the diagram Port 1 of 8051 microcontroller is connected to the data lines of ADC0809. The address lines C, B, and A are grounded. So, Channel 0 is selected to apply the analog input. To deactivate the remaining channels, they are grounded. Vref(+), Vcc and OE all are connected to +5V. Vref (-) and GND pins are connected to ground. CLK must be applied to the 10th pin of ADC by using a clock source. SOC line is used to start the conversion and ALE line is used to latch the address. To start the conversion and latch the address make these lines high through the microcontroller. Then conversion begins. After some time EOC line becomes high, to indicate the conversion is completed and the equivalent digital word is at Port 1. The timing diagram shows the entire procedure of analog to digital conversion. Fig: Timing diagram for ADC 0809 4
  • 5. Dr. C. SARITHA DEPT. OF ELECTRONICS Program: START: SETB P3.4 ; Set SOC = 1, ALE = 1 ACALL DELAY ; Call for the delay CLR P3.4 ; Clear SOC and ALE HERE: JNB P3.5,HERE ; Check, for EOC = 1 MOV A, P1 ; Move the data from Port 1 to A SJMP START ; Continue the same Result : Analog input in Volts Digital output in Hex 0 1 2 3 4 5 00 33 66 99 CC FF Interfacing of DAC0800 with 8051 : Digital to analog converters are used to convert digital quantity to analog quantity. D/A converter produces an output proportional to the digital quantity (binary word) applied to its input. A most widely used DAC chip is DAC 0800. Features of DAC0800: · It is an 8-bit DAC · It has fast settling time : 100ns · The conversion technique used is R-2R ladder network method · It operates at +4.5V to +18V supply · Low cost · Full scale error: ±1 LSB · Low power consumption 5
  • 6. Dr. C. SARITHA DEPT. OF ELECTRONICS Interfacing diagram of DAC with 8051: As shown in the diagram Port 1of 8051 microcontroller is connected to the data lines of DAC. The supply V+ is connected to the +5V or +12V. V- is connected to the -12V. The DAC 0800 is a current output device. So, an op-amp is used, to convert the output of DAC i.e., current to voltage. One of the applications of an op amp is as a current to voltage converter. The output of the op amp is the actual analog voltage, which is equivalent to the applied digital word through the microcontroller. Program: START: MOV A, #DATA ; Move the digital input to A MOV P1, A ; Move data 80H to Port 1 SJMP START ; Continue the same Result : Digital input In Hex Analog output In volts 00 40 80 CC FF 0 2.5 5 7.5 10 6
  • 7. Dr. C. SARITHA DEPT. OF ELECTRONICS Digital Data transmission : The transmission of binary data across a link can be accomplished either in parallel mode or serial mode. Parallel transmission : In parallel transmission, multiple bits are sent at a time. The advantage of parallel transmission is speed. But, the disadvantage of this parallel transmission is cost. Because, it requires n channels to transmit n bits. So, Parallel transmission is usually limited to short distances. Examples of parallel transmission include connections between a computer and a printer. Serial transmission : In serial transmission one bit follows another. It needs only one communication channel. The advantage of serial communication is cost. Examples of serial transmission include connections between a computer and a modem using the RS-232 protocol . Serial communication occurs in one of two ways : Asynchronous and Synchronous. 7
  • 8. Dr. C. SARITHA DEPT. OF ELECTRONICS Asynchronous transmission : In asynchronous transmission, the timing of the signal is unimportant. In asynchronous transmission, we send one start bit (0) at the beginning and one or more stop bits (1s) at the end of each byte. There may be a gap between each byte. Synchronous transmission : In synchronous transmission, timing is important. In synchronous transmission, we send bits one after another without start/stop bits or gaps. It is the responsibility of the receiver to group the bits. Serial Communication – Modes : The transmission mode is used to define the direction of signal flow between two devices. There are three types of transmission modes : Simplex, half-duplex and full duplex. Simplex Mode : In simplex mode, the communication is unidirectional, as on a one way street. Only one of the two stations on a link can transmit, the other can only receive. Keyboards and traditional monitors are both examples of simplex devices. The keyboard can only introduce input, the monitor can only accept output. 8
  • 9. Dr. C. SARITHA DEPT. OF ELECTRONICS Half-duplex Mode : In half-duplex mode, each station can both transmit and receive, but not at the same time. When one device is sending, the other can only receive, and vice versa. The half-duplex mode is like a one-lane road with two directional traffic. Walkie-talkies and CB (Citizen’s Band) radios are both half duplex systems. Full-duplex Mode : In full-duplex mode (also called duplex), both stations can transmit and receive simultaneously. The full-duplex mode is like a two way street with traffic flowing in both directions at the same time. One common example of full duplex communication is the telephone network. Serial Communication Protocols : A variety of communication protocols have been developed based on serial communication in the past few decades. Some of them are: 1. RS-232 2. RS-423 3. RS-485 4. RS422 5. USB 6. Fire Wire 7. Ethernet 8. MIDI 9. PCI Express 10. SPI & SCI 11. I2C 12. IrDA 9
  • 10. Dr. C. SARITHA DEPT. OF ELECTRONICS RS-232 – Recommended Standard 232: RS-232 has been a standard for decades as an electrical interface between Data Terminal Equipment (DTE) and Data Circuit-Terminating Equipment (DCE). A DTE is any device that is source or destination for binary data. A DCE is any device that transmits or receives data in the form of an analog or digital signal through a network. RS-232 is the oldest and most popular serial communication standard. RS232 stands for Recommended Standard number 232. It is developed by EIA (Electronics Industries Association) in 1960. It is the standard used in PCs and various types of equipment. It is used to connect only two devices. This RS232 standard defines the interface as a 25 wire cable with male and a female DB 25 pin connector attached to either end. The length of the cable may not exceed 15 meters (50 feet). However, since the standard was set long before the advent of TTL logic family, its input and output voltage level are not TTL compatible. In RS232, a 1 bit is represented by -3 to -15V, while a 0 bit is represented by +3 to +15V, making -3 to +3 undefined. For this reason, to connect any RS232 to a microcontroller system , we must use voltage converters such as MAX 232 to convert the TTL logic levels to the RS232 voltage level, and vice-versa. 8051 connection to RS232 : The 8051 has two pins that are used specifically for transferring and receiving data serially. These two pins are called TxD and RxD and are part of the port 3 (P3.0 and P3.1). Pin 11 of the 8051 (P3.1) is assigned to TxD and pin 10 (P3.0) is designated as RxD. These pins are TTL compatible. Therefore, they require line driver to make them RS232 compatible. One such line driver is the MAX232 chip. 10
  • 11. Dr. C. SARITHA DEPT. OF ELECTRONICS The MAX232 has two sets of line drivers for transferring and receikving data. The line drivers used for TxD are called T1 and T2, while the line drivers for RxD are designated as R1 and R2. In many applications only one set is used. For example, T1 and R1 are used together for TxD and RxD of the 8051, and the second set is left unused. In MAX232 the T1 line driver has a designation of T1 in and T1 out on pin numbers 11 and 14, respectively. The T1 in pin is the TTL side and is connected to TxD of the microcontroller, while T1 out is the RS 232 side that is connected to the RxD pin of the RS232 DB connector. The R1 line driver has a designation of R1 in and R1 out on pin numbers 13 and 12 respectively. The R1 in (pin 13) is the RS232 side that is connected to the TxD pin of the RS232 DB connector, and R1 out (pin 12) is the TTL side that is connected to the RxD pin of the microcontroller. RS-485 : RS-485 is an improved RS-422 with the capability to connect up to 16 devices (transceivers) on one serial bus to form a network. Such a network can have a "daisy chain" topology where each device is connected to two other devices except for the devices on the ends. Only one device may drive data onto the bus at a time. The standard does not specify the rules for deciding who transmits and when on such a network. That is up to the system designer to define. RS-423 : RS-423 is similar to RS-232C except that it allows for higher baud rates and longer cable lengths because it tolerates ground voltage differences between sender and receiver. The maximum signal voltage levels are ±6 volts. Ground voltage differences can occur in electrically noisy environments where heavy electrical machinery is operating. RS-422 : RS-422, like RS-232, is used to connect only two systems. It uses differential, or "double ended" data transmission, which means that data is transmitted simultaneously on two wires between two stations independent of the ground wire. Each signal requires 2 wires with a ground present in the system. The advantage of this method over RS-232 is higher speeds and longer cable lengths - 4000 feet at a 100K baud rate, for example. 11
  • 12. Dr. C. SARITHA DEPT. OF ELECTRONICS SPI – Serial Peripheral Interface: It is a three-wire based communication system. One wire each for Master to slave and Vice-versa, and one for clock pulses. There is an additional SS (Slave Select) line, which is mostly used when we want to send/receive data between multiple ICs. I2C – Inter-Integrated Circuit: Pronounced eye-two-see or eye-square-see, this is an advanced form of USART. The transmission speeds can be as high as a whopping 400KHz. The I2C bus has two wires – one for clock, and the other is the data line, which is bi-directional – this being the reason it is also sometimes (not always – there are a few conditions) called Two Wire Interface (TWI). It is a pretty new and revolutionary technology invented by Philips. FireWire : Developed by Apple, they are high-speed buses capable of audio/video transmission. The bus contains a number of wires depending upon the port, which can be either a 4-pin one, or a 6-pin one, or an 8-pin one. Ethernet: Used mostly in LAN connections, the bus consists of 8 lines, or 4 Tx/Rx pairs. Universal serial bus (USB): This is the most popular of all. Is used for virtually all type of connections. The bus has 4 lines: VCC, Ground, Data+, and Data-. ××××× 12