As i mansion my earlier post that is send by programer to make understand 8255 that which port is Input and which one is Output. Now how we are do that ?
Format of Control Word
Mode Definition Control Byte. Indicate by bit b7=1.
Port A and upper half of Port C (Group A)
Bit b3 to bit b6 control the mode and direction of Group A
b6, b5 mode operation
0 0 mode 0
0 1 mode 1
1 0 mode 2
b4 Port A direction, 0=output, 1=input
b3 upper half of Port C direction, 0=output, 1=input
Port B and lower half of Port C (Group B)
Bit b0 to bit b2 control the mode and direction of Group B
b2 mode operation, 0=mod 0, 1=mod 1
b1 Port B direction, 0=output, 1=input
lower half of Port C direction, 0=output, 1=input
Now take a Example that we need Port A as a input Port and Port B as a Out put Port What will be the Control Word ?
For that we need Bit D7 =1 ( For Input/Output Operation )
D6 =0
D5 =0
D4 =1 ( For Port A as Input)
D3 =0
D2 =0
D1 =0 (For Port B as Output)
D0 =0
So finally we got the number 10010000 or 90H.
Format of Control Word
Mode Definition Control Byte. Indicate by bit b7=1.
Port A and upper half of Port C (Group A)
Bit b3 to bit b6 control the mode and direction of Group A
b6, b5 mode operation
0 0 mode 0
0 1 mode 1
1 0 mode 2
b4 Port A direction, 0=output, 1=input
b3 upper half of Port C direction, 0=output, 1=input
Port B and lower half of Port C (Group B)
Bit b0 to bit b2 control the mode and direction of Group B
b2 mode operation, 0=mod 0, 1=mod 1
b1 Port B direction, 0=output, 1=input
lower half of Port C direction, 0=output, 1=input
Now take a Example that we need Port A as a input Port and Port B as a Out put Port What will be the Control Word ?
For that we need Bit D7 =1 ( For Input/Output Operation )
D6 =0
D5 =0
D4 =1 ( For Port A as Input)
D3 =0
D2 =0
D1 =0 (For Port B as Output)
D0 =0
So finally we got the number 10010000 or 90H.
No comments:
Post a Comment