Programmable Peripheral Interface - Microprocessors and Controllers II | CECS 347, Study notes of Microprocessors

Material Type: Notes; Class: Microprocessors and Controllers II; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 08/19/2009

koofers-user-ftp-1
koofers-user-ftp-1 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 347
LECTURE 9
82C55 PROGRAMMABLE PERIPHERAL
INTERFACE
The 82C55 is a high-performance, CHMOS version of the industry standard 8255A general purpose
programmable I/O devie which is designed for use with all Intel and most other microprocessors. It
provides:
24 I/O pins which may be individually programmed in 2 groups of 12
Provides 3 programming modes to allow for “handshaking” with peripherals
Low Power CHMOS
Completely TTL Compatible
2.5 ma DC Drive Capability on all I/O Port Outputs
pf3
pf4
pf5

Partial preview of the text

Download Programmable Peripheral Interface - Microprocessors and Controllers II | CECS 347 and more Study notes Microprocessors in PDF only on Docsity!

CECS 347

LECTURE 9

82C55 PROGRAMMABLE PERIPHERAL

INTERFACE

The 82C55 is a high-performance, CHMOS version of the industry standard 8255A general purpose programmable I/O devie which is designed for use with all Intel and most other microprocessors. It provides: 24 I/O pins which may be individually programmed in 2 groups of 12 Provides 3 programming modes to allow for “handshaking” with peripherals Low Power CHMOS Completely TTL Compatible 2.5 ma DC Drive Capability on all I/O Port Outputs

Interfacing 8255 with Parallel Port - C Code

** 8255.c ** ** Illustrates how 8255 may be configured for outputs on 8255 Ports ** A, B and C. ** ** 8255 is first setup with control word 0x ** Mode set flag active - bit 7 = 1 ** Mode selection 0 - bits 6 5 = 0 0 ** Port A output - bit 4 = 0 ** Port C (upper) output - bit 3 = 0 ** Mode selection 0 - bit 2 = 0 ** Port B output - bit 1 = 0 ** Port C (lower) output - bit 0 = 0 ** ** Data may then be output by calling out_data (port, data) where ** Port A - 0 ** Port B - 1 ** Port C - 2 ** ** P. H. Anderson, Morgan State Univeristy, June 20, ' ** / #include <stdio.h> #include <dos.h> #define DATA 0x03bc / set for your machine / #define STATUS DATA+ #define CONTROL DATA+ void reset(void); void write_clock(int a1a0); void set_control_word(void); void out_data(int port, int data); void main(void) { int port; reset(); set_control_word(); / now we are ready to go / / each port exercised with 0x00, 0xaa, 0x55 and 0xff */ for (port = 0; port<3; port++) { out_data(port, 0x00); delay(1000);

out_data(port, 0xaa); delay(1000); out_data(port, 0x55); delay(1000); out_data(port, 0xff); delay(1000); } } void set_control_word(void) { int a1a0 = 0x03; outportb(DATA, 0x80); /* out control word on data leads / / bring a1 a0 to 1 1, WR to 1 / outportb(CONTROL, ( ((0x00) | (a1a0 << 1) | 0x01) ^ 0x0b) & 0x0f); / now wink WR low and high / write_clock(a1a0); } void out_data(int port, int data) { int a1a0 = port; outportb(DATA, data); / put data on data leads / / set a1 and a0 to 0 0, 0 1 or 1 0, WR to 1 / outportb(CONTROL, ( ((0x00) | (a1a0 << 1) | 0x01) ^ 0x0b) & 0x0f); / now wink WR low and high / write_clock(a1a0); } void write_clock(int a1a0) { / bring WR low / outportb(CONTROL, (((0x00) | (a1a0<<1) & (~0x01) ) ^ 0x0b) & 0x0f); / bring WR back high / outportb(CONTROL, (( (0x00) | (a1a0<<1) | (0x01)) ^ 0x0b) & 0x0f); } void reset(void) { / bring reset high */ outportb(CONTROL, 0x08^0x0b);