Presentation is loading. Please wait.

Presentation is loading. Please wait.

06/25/091 Computer Interfacing Via the Parallel Port Carlos M. Oppus ECCE Program, AdMU.

Similar presentations


Presentation on theme: "06/25/091 Computer Interfacing Via the Parallel Port Carlos M. Oppus ECCE Program, AdMU."— Presentation transcript:

1 06/25/091 Computer Interfacing Via the Parallel Port Carlos M. Oppus ECCE Program, AdMU.

2 06/25/092 Objectives This lecture aims : 1)to give an overview of computer interfacing. 2)to give the basics of interfacing via the parallel port

3 06/25/093 Introduction Computer Interfacing means connecting different devices to the computer and being able to control or read the status of these devices. There are many ways to achieve computer interfacing. (1) Interfacing by making your own computer interface card. (2) Interfacing via the existing ports in your computers.

4 06/25/094 Introduction (cont …) namely (a) modem (b) internet (c) serial port (d) game port (e) parallel port (f) USB etc.

5 06/25/095 Parallel Port Computers are equipped with at least one parallel printer port card. This parallel port can be used as a general input-output device used for manipulating interfaced hardware. The printer port is designated as LPT 1, LPT 2 & LPT 3

6 06/25/096 Printer Port Parallel (printer) port as a general-purpose set of digital input and output port for interfacing devices. 8-bit digital input/output (I/O) register if an enhanced parallel port is being used otherwise it is just an output register 4-bit output register 4-bit input register (actually 5 inputs)

7 06/25/097 Parallel (Printer) Port Port ConfigurationI/O Port address LPT 1378H to 37AH LPT 2278H to 27AH

8 06/25/098 Table 1. Gantt Chart presenting the activities to be undergone for the project year. Table 1. Gantt Chart presenting the activities to be undergone for the project year.  8 output pins accessed via the DATA Port (pins 1 to 9)  5 input pins (one inverted) accessed via the STATUS Port (pins 10, 11, 12, 13, 15)  4 output pins (three inverted) accessed via the CONTROL Port (pins 1, 14, 16, 17) The remaining 8 pins are ground (pins 18 to 25) Parallel (Printer) Port

9 06/25/099 Parallel (Printer) Port note: high TTL level = 2.4V to 5V low TTL level = 0V to 0.8V (normally 0V) An OUT instruction to port address 378H (278H) and 37A (27A) can write the data directly to the connector pins. An IN instruction to port address 378H (278H) [if an enhanced parallel port is in use] and 379H (279H) can read the data directly from the connector pins.

10 06/25/0910 8-bit I/O if an enhanced parallel port is being used otherwise it is just an output port at address 378H (278H) example: PASCAL: port[$0378] := 255; // outputs 11111111 to pins 2 to 9 C: outportb(0x378,255); // outputs 11111111 to pins 2 to 9

11 06/25/0911 379H (279H)

12 06/25/0912 PASCAL: data := port[$037A] ; reads port 37AH i.e. reads the TTL levels of pins 13,12,10 & 11 respectively and places the corresponding values at the higher nibble of variable “data”. C: data = inportb(0x37A); reads port 37AH i.e. reads the TTL levels of pins 13,12,10 & 11 respectively and places the corresponding values at the higher nibble of variable “data”. Example

13 06/25/0913 37AH (27AH)

14 06/25/0914 PASCAL: Port[$037A] := 4; outputs 0100 to pins 17,16,14 & 1 respectively i.e. pin 17 is high, pin 16 is high, pin 14 is high and pin 1 is high. C: outportb(x037A,4); outputs 0100 to pins 17,16,14 & 1 respectively i.e. pin 17 is high, pin 16 is high, pin 14 is high and pin 1 is high. Example

15 06/25/0915 vbOut [port],[number] example: 'set port to 00001011 378H = 888 vbOut 888, 11 [variable]=vbInp([port]) example: ‘input from 379H = 889 PortNum%=vbInp(889) For 32bit VB (WIN95IO.DLL), use: Declare Sub vbOut Lib "WIN95IO.DLL" (ByVal nPort As Integer, ByVal nData As Integer) Declare Sub vbOutw Lib "WIN95IO.DLL" (ByVal nPort As Integer, ByVal nData As Integer) Declare Function vbInp Lib "WIN95IO.DLL" (ByVal nPort As Integer) As Integer Declare Function vbInpw Lib "WIN95IO.DLL" (ByVal nPort As Integer) As Integer

16 06/25/0916 Sample Circuits

17 06/25/0917 Sample Circuits

18 06/25/0918 Demonstration Appliance controller …

19 06/25/0919 Circuit Diagram

20 06/25/0920 Sample Program uses crt; var ch :char; begin clrscr; repeat port[$37A] := $0B; gotoxy(20,20); write('off'); ch := readkey; port[$37A] := $04; gotoxy(20,20); write('on '); ch := upcase(readkey); until ch = 'Q'; port[$37A] := $0B; end


Download ppt "06/25/091 Computer Interfacing Via the Parallel Port Carlos M. Oppus ECCE Program, AdMU."

Similar presentations


Ads by Google