8051 io interface

18
THE 8051 MICROCONTROLLER : I/O INTERFACING Presented by:- Abhinav Shubham(131046) & Tanmay Kapoor(131053) 05/14/2022

Upload: abhinav-shubham

Post on 15-Apr-2017

282 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: 8051 io interface

05/03/2023

THE 8051 MICROCONTROLLER :

I/O INTERFACING

Presented by:-

Abhinav Shubham(131046) &

Tanmay Kapoor(131053)

Page 2: 8051 io interface

05/03/2023

TOPICS OF DISCUSSION:-

What is IO interfacing?

Recapitulation of PIN Configuration of 8051

Devices to be interfaced

How they are interfaced?

Queries…

Page 3: 8051 io interface

05/03/2023

WHAT IS IO INTERFACING Input-output interface provides a method for transferring information between internal storage and external I/O devices. 

Peripherals connected to a microcontroller need special communication links for interfacing them with the CPU. The purpose of the communication link is to resolve the differences that exist between the CPU and each peripheral.

The major differences are:Peripherals are electromechanical and electromagnetic devices and their manner of operation is different from the operation of the CPU and memory, which are electronic devices. Therefore, a conversion of signal values may be required.The data transfer rate of peripherals is usually slower than the transfer rate of the CPU, and consequently, a synchronization mechanism may be needed, etc…..

Page 4: 8051 io interface

05/03/2023

PIN CONFIGURATION OF 8051Each port0,port1,port2,port3 are bidirectional and 8-bit I/O ports.

Above data for ATMEL AT89S51

Page 5: 8051 io interface

05/03/2023

DEVICES WE WILL BE INTERFACING:-

LEDS

LCD

KEYBOARD

Page 6: 8051 io interface

05/03/2023

INTERFACING LEDS

• Connection -Port 0 is connected to eight LEDs, each of them is connected to 5V through a 330 ohm resistor. Port 1 is connected to a DIP switch and a 10Kohm resistor

• Condition - Corresponding led should light up when switch is pressed , i.e.  if Switch at P1.0 is pressed then LED at P0.0 should light up.

Page 7: 8051 io interface

05/03/2023

INTERFACING LEDS(CONTD.)

Page 8: 8051 io interface

05/03/2023

CONSIDER…

Page 9: 8051 io interface

05/03/2023

HOW TO PROGRAM ?? ..

ASSEMBLY LANGUAGE

LOOP:mov p1,#0ffh ; To configure port1 for input.mov a,p1mov p0,asjmp LOOP ; Stay in infinite loop

C LANGUAGE

void main() unsigned char S; P1= 0xff; //port1 as input P0= 0x00; //port0 as output {while (1) { S=P1; //switch value P0=P1; //display on led }}

Page 10: 8051 io interface

05/03/2023

INTERFACING LCD• LCD is finding widespread use replacing LED• The declining prices of LCD• Ability to display numbers, characters and

graphics• Incorporation of a refreshing controller(graphics

controller, e.g. HD44780) within the LCD, there by relieving the CPU of an additional task.• LCD is far better than 7 segment display as it

has far better graphics. • Ease of programming for characters and

graphics

Page 11: 8051 io interface

05/03/2023

PIN OUT (LCD) ,1

6*2 DISPLAY

,5*7

MATRIX

Page 12: 8051 io interface

05/03/2023

Page 13: 8051 io interface

05/03/2023

LCD CONNECTIONS To send a command :-

Specify command to data pins.

Make R/W=0 (write operation)

Make RS=0 (select command register)

Give a H-to-L pulse to E(enable pin).

To send data:- Write data to data pins R/W =0 (write operation) Make RS=1 (select data

register) Give a H-to-L pulse to

E(enable pin).Data is written on positive edge of enable signal.

Page 14: 8051 io interface

05/03/2023

ANOTHER ASPECT TO BE TAKEN CARE OF…. BUSY FLAG(D7-PIN)

• Some delay is needed for LCD to successfully process the command or data(processing time of lcd).

• So, before data to be written, check if lcd is busy(check the D7- pin status(if 1 then busy)

• Reading the Busy flag.• Select command register (RS=0)• Select read operation (R/W=1)• Send enable signal (E=1)• Read the flag

Page 15: 8051 io interface

05/03/2023

KEYBOARD INTERFACING

• Keypad(keyboard) is a widely used input device with lots of application in our everyday life.

• From a simple telephone to keyboard of a computer, ATM, electronic lock, elevator, etc., keypad is used to take input from the user for further processing.

• Keypad is organized as a matrix of switches in rows and column.

Page 16: 8051 io interface

05/03/2023

SO HOW DOES KEYPADS WORK??..

It’s a matrix of rows and columns(here 4*4) Rows and columns intersect at 16 points.(when pressed) One of them are connected to power supply and other one grounded…

Page 17: 8051 io interface

05/03/2023

CONNECTIONS TO PORTS

Initially all the rows are set to zero by the controller and the columns are scanned to check if any key is pressed. In case no key is pressed the output of all the columns will be high.

Whenever a key is pressed the row and column corresponding to the key will get short, resulting in the output of the corresponding column goes to low (since we have made all the rows zero). This gives the column number of the pressed key.

Once the column number is detected, the controller set’s all the rows to high. Now one by one each row is set to zero by controller and the earlier detected column is checked if it becomes zero. The row corresponding to which the column gets zero is the row number of the digit.

Page 18: 8051 io interface

05/03/2023

THANK YOU!!!