Download presentation
Presentation is loading. Please wait.
1
The centronics port Interfacing to a PC
2
Connection Devices are connected to the parallel port (LPT) using a 25-way D-connector.
3
Pinout of centronics port
4
Outputs We use D0 to D7 for most outputs
D7 is the most significant bit We output all eight bits at once To get this output send (binary), 156 (decimal) or 9C (hex) to the output port D7 D6 D5 D4 D3 D2 D1 D0 1
5
Address The output port is at address 378H Outputs use the command:
OUT address, data Hexadecimal numbers can be written using &h at the start You can send 9CH to the output port using: OUT &h378, &h9C
6
Inputs The inputs are at address 379H
The inputs can be read using INP(address) INP(&h379) behaves like a variable and has a value that depends on the inputs so is used in statements like this: S=INP(&h379)
7
Addresses of pins
8
Inputting S is now equal to 9FH
To look at the input from the ERROR pin we need to input from the input port S=INP(&h379) D7 D6 D5 D4 D3 D2 D1 D0 BUSY ACK PE SLCT ERROR Not used 1 S is now equal to 9FH
9
Masking All the bit other than D3 need to be ignored – this is called masking D7 D6 D5 D4 D3 D2 D1 D0 BUSY ACK PE SLCT ERROR Not used 1
10
Making the mask The function AND is used for masking
Put 0s where you want the bits to be ignored If D3 is 0 the answer is zero If D3 is 1 the answer is not zero D7 D6 D5 D4 D3 D2 D1 D0 Hex BUSY ACK PE SLCT ERROR Not used AND 1 9F 08 Answer
11
Code for inputting and masking
S=INP(&h379) S=S AND &h08 IF S=0 THEN … IF S>0 THEN …
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.