Homework Reading Continue mp1 Labs Tokheim, Section 13-6 Questions?

Slides:



Advertisements
Similar presentations
Serial Interface Dr. Esam Al_Qaralleh CE Department
Advertisements

INPUT-OUTPUT ORGANIZATION
1 Homework Reading (linked from my web page) –S and S Extracts –National Semiconductor UART Data Sheet Machine Projects –mp2 due at start of class 12 Labs.
Review: Interrupts & Timers
DATA COMMUNICATIONS Some organisations concerned with standards: EIA - Electroonic Industries Association (RS standards including RS-232) IEEE - Institute.
1 Homework Reading –Tokheim, Section 13-6 Continue mp1 –Questions? Labs –Continue labs with your assigned section.
EET Advanced Digital Parallel Ports. n In contrast to serial ports, parallel ports ‘present’ all bits at one time. n ‘The parallel port reflects.
Eng. Husam Alzaq The Islamic Uni. Of Gaza
COMP3221: Microprocessors and Embedded Systems
1 The 9-Pin Connector Pin abbreviations (numbers in parentheses are the 25D pin numbers): 1. CD (8) 2. RD (Rx) (3) 3. TD (Tx) (2) 4. DTR (20) 5. SG (Ground)
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
PC 232 Serial Ports Ports –Connectors at back of PC –Plus related internal electronics to send/receive PC 232 Serial Port –Follows EIA/TIA 232 standards.
INPUT-OUTPUT ORGANIZATION
University of Tehran 1 Interface Design Serial Communications Omid Fatemi.
Technology Training that Works Hands of Data Communications, Networking & TCP/IP Troubleshooting.
Transmission Modes Serial Transmission  One bit is transmitted on a circuit at a time  Usually there is one transmit circuit and one receive circuit.
Computers in Surveying SVY2301 / E4006 Automated Surveying.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
The 8051 Microcontroller and Embedded Systems
Serial Port I/O Serial port sends and receives data one bit at a time. Serial communication devices are divided into: Data Communications Equipment (DCE),
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
Line Coding, Modem, RS232 interfacing sequences.
“Describe the overview of hardware interfacing and the serial communication interface. Describe the PIC18 connections to RS232. Explain the serial port.
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire conductors)
Serial Communications
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
EE 316 Computer Engineering Junior Lab Serial Ports, LCD Displays & PROMs.
Universal Asynchronous Receiver/Transmitter (UART)
Programming the I/O Hardware Reference: –textbook: Tanenbaum ch.5.1 – s.htmlwww.cs.umb.edu/ulab/UsingCforHardwareReg.
Interfaces and Synchronization Martin Weiss. EIA 232D Interface Standard u Synonymous with ITU V.24 u Asynchronous interface u Up to 19.2kbps u 50 foot.
PPI-8255.
1 Asynchronous voice band modem for IP data protocols overview features.
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
BASICS OF SERIAL COMMUNICATIONS BIRLA VISHWKARMA MAHAVIDYALAYA ELECTRONICS & TELECOMMUNICATION DEPARTMENT PRESENTING BY: ABHISHEK SINGH AMANDEEP.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
NARNARAYAN SHASTRI INSTITUTE OF TECHNOLOGY Prepared by: Wasu Ichcha kaur H Bhalani Nidhi M Dhakate Megha D MICROCONTROLLER.
Lecture # 14. RS – 232C Standard Standard for physical dimensions of the connectors. PC (DTE) Modem RS – 232C Cable Connected via serial port (DCE)
Serial mode of data transfer
UART Serial Port Programming
RS-232 Communications.
Homework Reading Labs Tokheim, Section 13-6 S and S Extracts
CS-401 Computer Architecture & Assembly Language Programming
Programming the I/O Hardware
IBM PC Controlled Keypunch4b
Lecture # 13.
Homework Reading (linked from my web page) Machine Projects Labs
SERIAL PORT PROGRAMMING
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
RS-232 Communications.
UART and UART Driver B. Ramamurthy.
Serial Communication: RS-232 (IEEE Standard)
Physics 413 Chapter 10.
Local Asynchronous Communication (RS-232)
UART Serial Port Programming
Programming the I/O Hardware
UART and UART Driver B. Ramamurthy.
UART Serial Port Programming
Serial Communication Interface: Using 8251
Parallel communication interface 8255
Serial Communication Interface
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
UART PC16550 (Universal Asynchronous Receiver/Transmitter) By Derwyn Hollobaugh
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Chapter 6 Transmission of Digital Data Interfaces and Modems
PIC Serial Port Interfacing
8051SERIAL PORT PROGRAMMING
PIC Serial Port Interfacing
AVR UART The UART, or Universal Asynchronous Receiver Transmitter, provides hardware support for a serial port on AVR processors Signaling is compatible.
Presentation transcript:

Homework Reading Continue mp1 Labs Tokheim, Section 13-6 Questions? Continue labs with your assigned section

Accessing I/O Devices Can’t directly access I/O devices under Unix Why not? Can do it under Tutor Why? Tutor allows us to learn about accessing I/O devices from “hands-on” experience

I/O Devices We’ll discuss 2 types of I/O devices in detail: Serial ports Parallel ports Covering the following aspects: Physical connectors Overview of interface electronics Handshake procedures I/O addresses assigned Programming procedures

Serial Ports (COM1: and COM2:) EIA RS-232C interface same connector as LPT1: COM1: a DB-9 connector on back of computer with a subset of the RS-232C signals (sufficient for async use) Requires a conversion cable (DB9 - DB25) to connect a PC to a standard RS-232C device such as analog modem “RS-232” level signals +3 to +15 volts is considered a logic 0 - 3 to - 15 volts is considered a logic 1 (Note: + 12 and -12 are voltages usually used) 13 1 25 14 5 1 9 6

Serial Port DB9 Pin Out Pin 1 Data Carrier Detect (DCD) Input Pin 2 Receive Data (RXD) Input Pin 3 Transmit Data (TXD) Output Pin 4 Data Terminal Ready (DTR) Output Pin 5 Signal Ground --- Pin 6 Data Set Ready (DSR) Input Pin 7 Request to Send (RTS) Output Pin 8 Clear to Send (CTS) Input Pin 9 Ring Indicator (RI) Input Single wire for sending data and single wire for receiving data plus return path (i.e., ground) Multiple control and status signals

Serial Port The “inside story” on a serial port: Control Bus (M/IO# and W/R#) Physical Connector +5V Address Bus (16 bits) +12V Transmit Data To/From Processor Chip National 16450 / 16550 Called a UART (“You-art”) See Note Receive Data EIA-423 Drivers and Receivers 4 Status Lines 2 Control Lines Ground Reference Data Bus (up to 32 bits) -12V Note: Implemented inside a “mother board” chip today, but backward compatible

Serial Port Handshake Connecting PC to an access server via a pair of modems Control / Status Lines (two straight-through cables) Data Terminal Ready indicates that PC is on and ready Data Set Ready indicates that modem is on and ready With Request to Send, PC tells modem to turn on its carrier With Clear to Send, the modem indicates that carrier is on With Data Carrier Detect, the modem indicates carrier seen With Ring Indicator, modem indicates incoming call DTR DTR DSR DSR RTS Analog signals on phone line RTS CTS CTS Remote Access Server PC DCD Modem Modem DCD RI RI TXD TXD RXD RXD GND GND

Serial Port Handshake Connecting two PCs via a NULL modem cable Behaves like a pair of modems Control / status lines are “cross-connected” Transmit and receive data are “cross-connected” DTR DTR DSR DSR RTS RTS CTS CTS DCD DCD GND GND TXD TXD RXD RXD (RI not normally needed)

Serial Port Handshake Bits are sent on TXD and RXD serially (one at a time) Bit Rate needs to be specified When the sequence starts and stops has to be specified How the bits are serialized has to be specified ASCII character sent With LSB first in time Optional Parity Bit Arbitrary time since last character sent Bit value = 0 +12V D0 D1 D2 D3 D4 D5 D6 D7 -12V Bit value = 1 One Start Bit One or Two Stop Bits Bit Duration = 1 / Bit Rate

Accessing the Serial Port PC specification allows up to four serial ports COM1: base address is 0x3F8 COM2: base address is 0x2F8 Each has up to eight port addresses Usually use six of these addresses Base: Receive buffer on read / Transmit buffer on write Base+1 Interrupts and FIFO buffer Base+2: Interrupt ID Base+3: Line control (set up by Tutor for us) Base+4: Modem control Base+5: Line status Base+6: Modem Status

Accessing the Serial Port Examples: Send an ‘A’ out on COM2: (port mtip connected to) ps 2f8 41 (ASCII A = 0x41) And you will see: ATutor> (Character A then prompt) Read a character from COM2: pd 2f8 02f8 00 00 c1 03 0b 00 00 00 ff ff ff ff ff ff ff ff

Accessing the Serial Port Port access support for C programs Can use functions specific to the PC We have our own library ($pcinc/cpu.h) Look at example $pcex/echo.c Function prototypes are in cpu.h void outpt(int port, unsigned char outbyte); unsigned char inpt(int port); Port address < 0xFFFF Unsigned char is the 8-bit character Example for COM2: outpt(0x2F8, 0x41);

Accessing the Serial Port Don’t want to use hard coded numbers! Look at $pcinc/serial.h for symbolic constants #define COM1_BASE 0x3f8 #define COM2_BASE 0x2f8 #define UART_TX 0 /* send data */ #define UART_RX 0 /* recv data */ . . . #define UART_LCR 3 /* line control */ #define UART_MCR 4 /* modem control */ #define UART_LSR 5 /* line status */ #define UART_MSR 6 /* modem status */

Accessing the Serial Port Construct addresses using symbolic constants unsigned char status; outpt(COM1_BASE + UART_TX, ‘A’); status = inpt(COM1_BASE + UART_LSR);

Parallel Port (LPT1:) LPT1: a DB25 connector on back of computer Data appears on pins 2-9 Control/Status on pins 1 & 10-17 Pins 18-25 are ground “TTL” level signals 0-1volts is considered low and a logic 0 3-5volts is considered high and a logic 1 Very simple interface to understand and use Provides 8 bits of output (one byte at a time) No transformation of data Simple handshake protocol 13 1 25 14

Parallel Port The “inside story” on a parallel port: Control Bus (M/IO# and W/R#) +5V Physical Connector Address Bus (16 bits) 8 Data Lines (D0–D7) To/From Processor Chip 5 Status Lines (Busy) Interface LSI Chip(s) See Note 4 Control Lines (Strobe#) Ground Reference Lines Data Bus (up to 32 bits) Note: Implemented inside a “mother board” chip today, but backward compatible

Parallel Port Printer Handshake Data byte sent to parallel data port (all 8 bits at once) 1. Printer indicates ready for next data byte (Busy = 0) 2. PC sets up data bits on data lines D0-D7 3. PC tells printer that data is ready Strobe# = 0 4. Printer acknowledges or “acks” (Busy = 1) and takes data 5. PC sets Strobe# =1 to be ready for next cycle Signals on Pins One Handshake Cycle D0-D7 (from PC) Byte N-1 2 (Data valid for Byte N) 2 Byte N+1 * * * Strobe# (from PC) 5 3 5 3 * * * Busy (from Prtr) 4 1 1 * * *

Accessing Parallel Port IBM defines up to three parallel port addresses We will use “LPT1:” with 0x378 as base address Base used to send data to printer (D0-D7) Base+1 used to get status byte (with MSB = Busy# signal) Base+2 used for control (with LSB = Strobe signal) Can access parallel port using Tutor ‘ps’ command ps 378 FF to set all data output bits to ones ps 378 0 to set all data output bits to zeros Write Read 0x378 D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 0x379 - - - Bsy# Ack# PE SL Err# IRQ 0x37a D IQ SI IN# AF ST D IQ SI IN# AF ST

Accessing the Parallel Port Examples: Note that status port address is “read only” pd 378 0378 00 7F E0 . . . ps 378 55 0378 55 7F E0 . . . {has effect on 378} ps 379 66 0378 55 7F E0 . . . {no effect on 379}

Accessing Parallel Port Port access support for C programs Can use functions specific to the PC We have our own library ($pcinc/cpu.h) Look at example $pcex/testlp.c Function prototypes are in $pcinc/cpu.h void outpt(int port, unsigned char outbyte); unsigned char inpt(int port); Port address < 0xFFFF Unsigned char is the 8-bit character Example: outpt(0x378, 0xFF);

Accessing the Parallel Port Don’t want to use hard coded numbers! Look at $pcinc/lp.h for symbolic constants #define LPT1_BASE 0x378 #define LP_DATA 0 /* 8 bits of data */ #define LP_STATUS 1 /* in: status bits */ #define LP_CNTRL 2 /* in, out: control bits*/ Construct addresses using symbolic constants unsigned char cntrl, status; outpt(LPT1_BASE + LP_CNTRL, cntrl); status = inpt(LPT1_BASE + LP_STATUS);