ACCESSING Pcs PARALLEL PORT DATA and CONTROL BUS
Total Page:16
File Type:pdf, Size:1020Kb
LAB 4-3 ACCESSING PCs PARALLEL PORT DATA AND CONTROL BUS
Objectives To use the data pins of a PC parallel port as an output port To use the control pins of a PC's parallel port as an output port
References Mazidi, Volumes I & II: Chapters 18
Materials 80x86 IBM (or compatible) computer MASM (or compatible) assembler Digital trainer 74LS244
In this lab we examine the data pins and control pins of the printer's parallel port and then show how to access them. Every PC has a parallel port accessible through the DB25 connector. The printer cable end going to the PC is DB25 male while the end going to the printer is a centronics connector. The pin-out for both are shown in Chapter 18 of the textbook.
ACTIVITY 1 As discussed in Chapter 18 of the textbook, three I/O port addresses are assigned to each parallel port: one for the data signals, one for the status signals, and one for the control signals. In many PCs, LPT1 has the base I/O address of 03BCH; therefore, port 3BCH is for data, 3BDH is for status, and 3BEH for control signals. In some PCs, the base I/O address for LPT1 is 0378H and for this reason the base I/O address belonging to a given LPT must be fetched from the BIOS data area. We use Debug to do that as follow. In DEBUG, dump the BIOS data area belonging to this parallel port to get the base address of the parallel port Fill in the table in question 1 of worksheet questions.
-D 40:00
Buffering the printer's port data bus To avoid damaging the data bus of the parallel port, the data buses are connected to a 74LS244. This not only isolates the data pins but also boosts the driving current of the data bus. Next we see how to access the data bus portion of the parallel port.
ACTIVITY 2 The following steps show how to access the data section of a parallel port. For this activity, go through these steps and make sure they work, since they are used in subsequent labs in this section.
1. On the breadboard, set up the circuit shown in the textbook (Fig. 18-11). Connect D0-D7 portion for this activity. Notice that the data pins of the PC parallel port are buffered first by the 74LS244 before it is connected to the LEDs of the digital trainer. Make sure that all the grounds are connected to the same point. Notice that the PC parallel port has 8 ground pins (pins 18 - 25 on the DB25). Make sure one of them is connected to the ground on the breadboard.
2. In DEBUG, assemble and run the following program to send data to the LEDs (Recall that in DEBUG, H for hex need not be typed. Also, do not type comments, they are given for clarity). After typing in the program below, set G=100 and run it. Then examine the LEDs; you should see 0101 0101 (55 hex).
-A 100 MOV DX,3BCH ;base I/O address for the LPT port (put the result of activity 1) MOV AL,55H ;AL=55H OUT DX,AL ;send it to data pins of LPT port INT 3 ;stop and dump the registers
4. In the line "MOV AL,55H" change the data 55H to AAH and run the program again. This step ensures that the data pins work for both low and high and no bit is stuck to a 0 or 1 state.
ACTIVITY 3 After making sure that your circuit in Activity 1 works properly, write a program that counts in binary and sends each count to the LEDs. This is an 8-bit counter and the maximum number is 1111 1111 (FF in hex or 255 decimal).
Provide a sufficient time delay in between each count so that you can see the count on the LEDs.
Accessing control bits of the PC's parallel port In the first two activities, we accessed only the data pins of the PC's parallel port. We can also use the control pins of the parallel port for the purpose of outputting data. We first must make sure that they are buffered with the 74LS244. See Figure 18-11 in textbook.
ACTIVITY 4 After buffering C0 - C3 of the control port, connect them to the LEDs. Notice that we are using only the lower four bits of the control port: C0, C1, C2, and C3. Assemble and run the following program (in DEBUG) to test the connection.
-A 100 MOV DX,3BEH ;LPT'S control address (use the address for your PC) MOV AL,05 ;AL=5 OUT DX,AL ;send it to control pins of the LPT port INT 3 ;stop and dump the registers
Run the above program and examine the LEDs. Then set AL=00001010 (0A in hex) and run the program again. Now you are ready to combine this activity with Activity 2 to make a 12-bit counter.
ACTIVITY 5 Using the 8 bits of the data port (from Activity 3) and the 4 bits of the control port (from Activity 4), write and run a program that counts in binary and sends each count to 12 LEDs. This is a 12-bit counter and the maximum number is 1111 1111 1111 binary (FFF in hex or 4097 decimal). While the lower 8 bits go to the data pins, the upper 4 bits go the control pins of the LPT port. WORKSHEET QUESTIONS 1. Use the dump command of DEBUG to dump the BIOS data area 40:0008 – 000F and get the base I/O port address of the PC's LPT port. Indicate which LPT port is installed.
40:0008 40:0009
40:000A 40:000B
40:000C 40:000D
40:000E 40:000F
2. In a given PC, the I/O base address for one of the printer's parallel ports is 378H. Indicate the port addresses for each of the following. (a) data pins (b) status pin (c) control pins
3. True or false. The parallel port on every 80x86 IBM PC/compatible supports data outputting using its data pins.
4. True or false. The parallel port on every 80x86 IBM PC/compatible support data outputting and data inputting using its data pins.
5. True or false. From the point of view of the PC, the control pins of the parallel port in all PCs are outputs.