Parallel Ports of PC Methods of interfacing Examples.

Slides:



Advertisements
Similar presentations
MICROPROCESSOR BASED SYSTEM DESIGN
Advertisements

Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
There are two types of addressing schemes:
Chapter 2 Machine Language.
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
COE Computer Organization & Assembly Language
Introduction to C Programming
UniMAP 1 Interfacing DIO ADC Keypad LCD. UniMAP 2 Using I/O ports in C program on Linux machine 1.Need permission to access the port. This is done by.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
P Address bus Data bus Read-Only Memory (ROM) Read-Write Memory (RAM)
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
Presented By Chandra Shekar Reddy.Y 11/5/20081Computer Architecture & Design.
06/25/091 Computer Interfacing Via the Parallel Port Carlos M. Oppus ECCE Program, AdMU.
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi.
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Chapter Introduction to Computers and Programming 1.
BLOCK DIAGRAM OF COMPUTER
Aug CMSC 104, LECT-021 Machine Architecture and Number Systems Some material in this presentation is borrowed form Adrian Ilie From The UNIVERSITY.
Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate.
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Input/Output. I/O Initiation & Control  Transfer of data between circuitry external to the microprocessor and the microprocessor itself.  Transfer of.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Basic Architecture Lecture 15. In general, if the number of bits is n, then the number of different combinations of 0s and 1s that can be made is 2 n.
COSC 456 Lesson 19: Laboratory 5 IBM PC Interfacing The parallel port is a 25-pin DB-25 (D-shaped) connector accessible from the back of the PC The expansion.
Computer Architecture Lecture 9 by Engineer A. Lecturer Aymen Hasan AlAwady 10/2/2014 University of Kufa - Information Technology Research and Development.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
PHY 201 (Blum)1 Microcode Source: Digital Computer Electronics (Malvino and Brown)
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Electronic Analog Computer Dr. Amin Danial Asham by.
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
Programmable Logic Controllers LO1: Understand the design and operational characteristics of a PLC system.
File Systems cs550 Operating Systems David Monismith.
Basic I/O Interface Fixed Address Variable Address
Khaled A. Al-Utaibi  I/O Ports  I/O Space VS Memory Space  80x86 I/O Instructions − Direct I/O Instructions − Indirect I/O Instructions.
1 Microprocessors CSE – 341 Basic I/O Interfacing.
PLC ARCHITECTURE – Memory 2 by Dr. Amin Danial Asham.
I/O Interface. INTRO TO I/O INTERFACE I/O instructions (IN, INS, OUT, and OUTS) are explained. Also isolated (direct or I/O mapped I/O) and memory-mapped.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Hardware Information Created by Nasih 1. Hardware  The physical components of a computer system, including any peripheral equipment such as printers,
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
WHY PARALLEL PORT? The simplest computer controlled robot Requires only basic programming skills in C to start off with Can take inputs from your robot.
Computer Architecture and Number Systems
Parallel Input/Output
Interfacing I/O Devices
Computing Systems Organization
Input/Output.
Computer Organization & Assembly Language Chapter 3
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
Physics 413 Chapter 10.
EET 2261 Unit 11 Controlling LCD and Keypad
Interfacing Memory Interfacing.
Instruction cycle Instruction: A command given to the microprocessor to perform an operation Program : A set of instructions given in a sequential.
EET 2261 Unit 11 Controlling LCD and Keypad
MARIE: An Introduction to a Simple Computer
Chapter 5: Computer Systems Organization
Machine Architecture and Number Systems
Computer Architecture
Presentation transcript:

Parallel Ports of PC Methods of interfacing Examples

The parallel port consist of 25 pins:  8 data input/outputs  4 control outputs  5 status inputs  8 pins are grounded

25 pin female (DB25) connector The registers found in standard parallel port are: Data register Status register Control register

Parallel Port Details

Parallel Port Details (Cont.)

 Data registers are connected to data lines.  Control registers are connected to control lines.  Status register is connected to Status lines.  What you write to these registers, will appear in corresponding lines as voltages. You can measure it with a Multimeter.  Whatever you give to parallel port as voltages can be read from these registers ◦ For example, if we write '1' to Data register, the line Data 0 will be driven to +5v (actually 3.5 V). This way we can programmatically turn on and off any of the data lines and control lines.

 In an IBM PC, these registers are IO mapped and will have unique address. We have to find these addresses to work with parallel port.  For a typical PC, ◦ the base address of LPT1 is 0x378 ◦ the base address of LPT2 is 0x278.  The data register resides at this base address  The status register at base address + 1  The control register is at base address + 2.  So once we have the base address, we can calculate the address of each registers in this manner. The table in the next slide shows the register addresses of LPT1 and LPT2.

The parallel port consists of three bytes in the PC I/O address space, starting at address 0x378. The first byte at 0x378 is for 8 bits of output The second byte at 0x379 is for 5 bits of input, 3 bits unused The third byte at 0x37A is for 4 bits of output, 4 bits of setup 0x378 is the address of the parallel port data register

 Base port numbers: 0x378, 0x278  The normal method ◦ Call linux.ioperm() to get permission to access the ports ◦ Use in() to read from the port (check x86 Instructions) ◦ Use out() to write to the port (check x86 Instructions) ◦ The command #include(“linux.hhf”) provides the library for the functions of linux.ioperm()

 The function ioperm (...) is Linux specific. ◦ It allows an application program to access to the 80x86 I/O- addresses within the range 0x000 to 0x3ff.  Call ioperm() to get permission to access the ports  Use in() to read data from the port. ◦ These instructions read a byte, word, and double word from an input port and place the input data into the accumulator register.  Must use DX register to hold the 16-bit port number  Example: in($379, AL) to read data from port $379 (line 10-line13) and place the information into the register AL

 out( ) provides a HLA language interface to the machine instruction that outputs the accumulator to the specified port (i.e., I/O port) using the I/O address space instead of the memory address space.  Must use DX register to hold the 16-bit port number Example: mov($FF, AL); mov($378, DX); out(AL, DX) // this will send binary data 1111_1111 stored in AL to data port $378 (line2 - line9)

 Give your program permission to access the port. This is done by calling the ioperm() function  The syntax is ioperm(from, num, turn_on), where: ◦ from is the first port number to give access to ◦ num the number of consecutive ports to give access to ◦ turn_on is a boolean value.  Example: ioperm(0x300, 5, 1) would give access to ports 0x300 through 0x304 (a total of 5 ports). The last argument is a Boolean value specifying whether to give access to the program to the ports (true (1)) or to remove access (false (0)). You can call ioperm() multiple times to enable multiple non-consecutive ports.  ioperm() can only give access to ports 0x000 through 0x3ff;  The ioperm() call requires your program to have root privileges; thus you need to run it as the root user

 LEDS are connected to pins D 0 to D 7 and to the ground pins, respectively  Light the LED or output data (value) by out(AL, DX)  Value of AL is associated with the pins of the parallel port  Example: To light D 0 to D 3 you should call mov(15, AL); mov($378, DX); out(AL,DX); = 15.

 You have to think the value you give to the program as a binary number.  Every bit of the binary number control one output bit. The following describes the relation of the bits, parallel port output pins and the value of those bits. Pin Bit D 0 D 1 D 2 D 3 D 4 D 5 D 6 D 7 Value Note: The value above is the numeric value to send to printer port

How does it look In HLA under Linux? program Interface; #include(“stdlib.hhf”); #include(“linux.hhf”); begin Interface; stdout.put ("You must be root to run this program“, nl); linux.ioperm($378,3,1): //open port //Get a data from keyboard by stdin.get(AL); //Similar get a port number from key board mov($AA, AL); mov($378,DX); out(AL,DX);//send to port $378 linux ioperm($378,3,0); //close port End Interface;