CHAPTER 4 I/O PORT PROGRAMMING

Similar documents
ELEG3923 Microprocessor Ch.4 I/O Ports

1. Pin diagram of 8051 and ports

8051 I/O and Class 6 EE4380 Spring 03. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Basic I/O Interface

Z8 Pod Adapter. for the. Fluke 9000-Series Troubleshooter

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

TUG Combo Board

4. Configuring Cyclone II Devices

Chapter Two - SRAM 1. Introduction to Memories. Static Random Access Memory (SRAM)

Fremont Micro Devices, Inc.

5I20 ANYTHING I/O MANUAL

Part 1 Using Serial EEPROMs

App Note Application Note: Addressing Multiple FPAAs Using a SPI Interface

ET2640 Microprocessors

I/O Design. Input / Output Instructions. Engineering 4862 Microprocessors. Lecture 23. Cheng Li

8051 INTERFACING TO EXTERNAL MEMORY

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

C H A P T E R 1 INTRODUCTION

ECEN 449 Microprocessor System Design. Memories. Texas A&M University

DS1855 Dual Nonvolatile Digital Potentiometer and Secure Memory

Applications. Features

ET355 Microprocessors Friday 6:00 pm 10:20 pm

3. The MC6802 MICROPROCESSOR

Name EET 1131 Lab #14 Random Access Memory

ONYX-MM-XT PC/104 Format Counter/Timer & Digital I/O Module

Chapter 3. Bit Addressable Area. By DeccanRobots

Data Acquisition Using INS8048

Z Z-280 MT8930, MT8992/3/4/5 MT8880 MT8888 MT8889 MT8980/1 MT8985, MT8986 (DIP-40) MT8986 (PLCC-44) MT8920B MT8952B

EECS 373 Design of Microprocessor-Based Systems

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

SH69P21 EVB. Application Note for SH69P21 EVB SH69P21 EVB SH69P21

WT6510. USB Keyboard Controller (Mask ROM Type)

IRCS2277S Demo Board

Microprocessor & Interfacing Lecture DMA Controller--1

QPro XQR17V16 Radiation Hardened 16Mbit QML Configuration PROM

EET2411 DIGITAL ELECTRONICS. A device or electrical circuit used to store a single bit (0 or 1) Ex. FF.

User-configurable Resolution. 9 to 12 bits (0.5 C to C)

DS1306. Serial Alarm Real Time Clock (RTC)

The Timers/Counters The Serial Interface The Interrupt System Reset P0.0-P0.7 P2.0-P2.7. Port 2 Drivers. Port 2 Latch

DEV16T. LCD Daughter board

CHAPTER 11 INTERRUPTS PROGRAMMING

Embedded Controller Programming

PIC KIT 2 BASIC-USERS GUIDE FEMTO ELECTRONICS

CHAPTER 1 MICROCOMPUTER SYSTEMS. 1.1 Introduction. 1.2 Microcontroller Evolution

GIGAVAC Contactors I 2 C Communication

I2C-OC805S, I2C-OC805SA I2C Bus 8-Output Open Collectors

PAS 9796/DIO ENGINEERING SPECIFICATION

SOLUTION MANUAL FOR THE 8051 MICROCONTROLLER 4TH EDITION BY MACKENZIE AND PHAN

8255 Programmable Peripheral Interface Architecture MCT/UNIT III/NARASIMHARAJ/LECTURE NOTES /IV MECH A

GL116 ENCODER/DECODER MANUAL GLOLAB CORPORATION

User-configurable Resolution. 9 to 12 bits (0.5 C to C)

PIO 8255 (cont..) M Krishna kumar MAM/M3/LU9e/V1/2004 1

ENGIN 112 Intro to Electrical and Computer Engineering

eprom 1 Fri Oct 13 13:01:

Microcontrollers can be considered as self-contained systems with a processor, memory and I/O ports.

QPro XQ17V16 Military 16Mbit QML Configuration PROM

< W3150A+ / W5100 Application Note for SPI >

EECS 373 Design of Microprocessor-Based Systems

Memory & Logic Array. Lecture # 23 & 24 By : Ali Mustafa

ACE24AC02A1 Two-wire Serial EEPROM

DIO16 8 Channel digital input and 8 Channel digital output board. V1.0 August CANBUS-DIO16 Rev B v1.0

ACE24AC128 Two-wire Serial EEPROM

4I39 RS-422 ANYTHING I/O MANUAL

Architecture of 8085 microprocessor

PIN DIAGRAM. Richa Upadhyay Prabhu. NMIMS s MPSTME January 19, 2016

USB-1208LS Specifications

MODULE 12 APPLICATIONS OF MEMORY DEVICES:

Digital Fundamentals. Integrated Circuit Technologies

DS1845 Dual NV Potentiometer and Memory

DS3668 Quad Fault Protected Peripheral Driver

SH69P48A EVB. Application Notes for SH69P48A EVB SH69V48A JP2 J4(ICE_J4) S1 IDD TEST JP1 74HC273 JP4 JP3 74HC273 JP6 STKOVE JP7 SW1 J5(ICE_J5)

Application Note AN21. Power-On-Reset (POR) Software Implementation. Low Voltage Reset (LVR) Watchdog Timer. Hardware Implementation

4-Megabit 2.7-volt Only Serial DataFlash AT45DB041. Features. Description. Pin Configurations

ACE24AC16B Two-wire Serial EEPROM

Application Note AN232-10

On/Off Control Using the Remote Control (RC) pin on Flex Power Modules

DS2223/DS2224. EconoRAM FEATURES PACKAGE OUTLINE. PIN CONNECTIONS Pin 1 GND Ground Pin 2 DQ Data In/Out Pin 3 V CC Supply Pin 4 GND Ground

Logic Chip Tester User Manual SW Version /8/2012. Chapter 1 Introduction/Background

ACE24AC64 Two-wire Serial EEPROM

UMBC. Select. Read. Write. Output/Input-output connection. 1 (Feb. 25, 2002) Four commonly used memories: Address connection ... Dynamic RAM (DRAM)

Basic Input/Output Operations

CHAPTER: 3 PROGRAMMABLE PERIPHERAL INTERFACE & ELECTROMECHANICAL DEVICES INTERFACING

MCS-51 Serial Port A T 8 9 C 5 2 1

DS2401 Silicon Serial Number

I2C-AO112DIx I2C-Bus 4-20mA Analog Output Boards Din-Rail supports

MAINTENANCE MANUAL GE TRUNKING CARD 1e 19D903536P1

5I21 SERIAL ANYTHING I/O MANUAL

Product Change Notice

MachXO3 Soft Error Detection (SED)/ Correction (SEC) Usage Guide

Memory System Design. Outline

Table 1 summarizes the supported device attribute differences between KSZ9021GN and KSZ9031MNX PHY devices. Device Attribute KSZ9021GN KSZ9031MNX

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

11. SEU Mitigation in Stratix IV Devices

ELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O

MCS6522 V E R S A T IL E IN T ERFACE A D A PTER

8051 Microcontroller memory Organization and its Applications

PCI-3E. PCI Interface Card Page 1 of 7. Description. Features

Errata Sheet. May 6, 1996 / Release 1.3. Marking :

SLCD1-IC Serial LCD Processor

DS2401 Silicon Serial Number

Transcription:

CHAPTER 4 I/O PORT PROGRAMMING

I/O Port Pins The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8 pins All the ports upon RESET are configured as input, ready to be used as input ports When the first 0 is written to a port, it becomes an output To reconfigure it as an input, a 1 must be sent to the port To use any of these ports as an input port, it must be programmed

Port 0 It can be used for input or output Each pin must be connected externally to a 10K ohm pull-up resistor This is due to the fact that P0 is an open drain, unlike P1, P2, and P3 Open drain is a term used for MOS chips in the same way that open collector is used for TTL chips

Port 0 (cont.)

Port 0 as Input In order to make port 0 an input, the port must be programmed by writing 1 to all the bits

I/O Port Cell

Dual Role of Port 0 Port 0 is also designated as AD0-AD7 Allowing it to be used for both address and data When connecting an 8051/31 to an external memory, port 0 provides both address and data

Port 1 Port 1 can be used as input or output In contrast to port 0, this port does not need any pull-up resistors since it already has pullup resistors internally Upon reset, port 1 is configured as an input port

Port 1 as Input To make port 1 an input port, it must be programmed as such by writing 1 to all its bits

Port 2 Port 2 can be used as input or output Just like port 1, port 2 does not need any pullup resistors since it already has pull-up resistors internally Upon reset, port 2 is configured as an input port

Port 2 as Input or Dual Role To make port 2 an input port, it must be programmed as such by writing 1 to all its bits In many 8051-based system, P2 is used as simple I/O In 8031-based systems, port 2 must be used along with P0 to provide the 16-bit address for the external memory Port 2 is also designated as A8 A15 Port 0 provides the lower 8 bits via A0 A7

Port 3 Port 3 can be used as input or output Port 3 does not need any pull-up resistors Port 3 is configured as an input port upon reset This is not the way it is most commonly used Port 3 has the additional function of providing some extremely important signals

Port 3 (cont.)

Different ways of Accessing Entire 8 Bits

I/O Ports and Bit Addressability Sometimes we need to access only 1 or 2 bits of the port

I/O Ports and Bit Addressability (cont.) Instructions that are used for signal-bit operations are as following:

Checking an Input Bit The JNB and JB instructions are widely used single-bit operations They allow you to monitor a bit and make a decision depending on whether it s 0 or 1 These two instructions can be used for any bits of I/O ports 0, 1, 2, and 3 Port 3 is typically not used for any I/O, either single-bit or byte-wise

7

7

0 0

Reading Input Pins vs. Port Latch In reading a port Some instructions read the status of port pins Others read the status of an internal port latch When reading ports there are two possibilities: Read the status of the input pin Read the internal latch of the output port Confusion between them is a major source of errors in 8051 programming Especially where external hardware is concerned

Reading Latch for Output Port Some instructions read the contents of an internal port latch instead of reading the status of an external pin For example, look at the ANL P1,A instruction and the sequence of actions is: It reads the internal latch of the port and brings that data into the CPU This data is ANDed with the contents of register A The result is rewritten back to the port latch The port pin data is changed and now has the same value as port latch

Reading Latch for Output Port (cont.) Read-Modify-Write The instructions read the port latch normally read a value, perform an operation then rewrite it back to the port latch

Read-modify-write Feature The ports in 8051 can be accessed by the Read-modify-write technique This feature saves many lines of code by combining in a single instruction all three actions Reading the port Modifying it Writing to the port