tailieunhanh - The 80x86 IBM PC and Compatible Computers- P13
The 80x86 IBM PC and Compatible Computers- P13: Praised by experts for its clarity and topical breadth, this visually appealing, one-stop source on PCs uses an easy-to-understand, step-by-step approach to teaching the fundamentals of 80x86 assembly language programming and PC architecture. Offering users a fun, hands-on learning experience, it uses the Debug utility to show what action the instruction performs, then provides a sample program to show its application. | PC Parallel Port 25-Pin D-Connector DO D1 D2 CO Cl C2 C3 GND 2 1 1 1 74LS244 2 TC KT W 4 16 6 14 8 12 11 9 13 7 15 5 17 3 1J 119 J_ U_ Ifi__ 17 -1 18 - 25 2 1 6. 1 7415244 1OK POT 5V Figure 18-12. LCD Connection to Parallel Port PC Parallel Port 25-Pin D-Connector ULN2003 DO D1 D2 D3 74LS244 18 16 14 12 GND 1G 2G Stepper Motor COM COM 5V use a separate power supply for motor Connection for Stepper Motor GND 5V 18 - 25 2 2 3 4 4 _6 5 8 ULN2003 Pin 8 Pin 9 Figure 18-13. Stepper Motor Connection to Parallel Port Please purchase PDF Split-Merge on to remove this watermark. SECTION BIDIRECTIONAL DATA BUS IN PARALLEL PORTS 565 Data input buffering Assuming that the data port of LPT supports a PS 2-type bidirectional bus one can use the circuit in Figure 18-14 to buffer it. Notice the use of lOK-ohms pull-up resistors. This is needed to prevent damage to the data port. PC Parallel Port 25-Pin D-Connector CO GND DO D1 D2 D3 D4 D5 D6 D7 Vcc Resistors 10K Ohms 74LS244 2 J 4 7 Hi Notice thot CO is inverted internally. 18 - 25 2 4 6 8 11 13 15 17 11 16 14 12 S. 1_ 1 3 z Input switches Figure 18-14. Buffering LPT s Data Port for Input in Bidirectional Ports BIOS data area and LPT I O address When accessing the PC s parallel port for data acquisition your program should get the base I O address from the BIOS data area. This makes the program dynamic and able to run on any PC. In Assembly language use the following code PUSH DS save DS PUSH AX save AX SUB AX AX AX 0 MOV DS AX DS 0 for BIOS data area MOV DX 408 get the LPT1 I O base address POP AX restore AX POP DS restore DS now DX has the I O base address of LPT1 In C we can use the following code main unsigned int far xptr xptr unsigned int far 0x00000408 outp xptr mybyte send mybyte to LPT s data port 7 Example 18-12 demonstrates how to detect the presence of LPT 1 and determine its port I O address. Please 6fchase PDF Split-Merge onWWWypdfmmlOAemoA .
đang nạp các trang xem trước