Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

8
Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU

Transcript of Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

Page 1: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

Lecture 14Basic I/O Interface

Presented ByDr. Shazzad Hosain

Asst. Prof. EECS, NSU

Page 2: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

7-segment LED Display00H – 03H are the I/O ports

7654 32100000 0000 Port A0000 0001 Port B0000 0010 Port C0000 0011 Command Register

5 6 4 2 8 9 0 1MEM

1. For 8 (eight) times1. Send data through port A2. Select a segment through port B

OUT PORT, DATA OUT DX, AL

Page 3: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

7-segment LED Display00H – 03H are the I/O ports

7654 32100000 0000 Port A0000 0001 Port B0000 0010 Port C0000 0011 Command Register

5 6 4 2 8 9 0 1MEM

MOV BX, 8 ; countMOV AH, 7FH ; selectionMOV SI, OFFSET MEM-1 MOV DX, 01H ; port B

DISP1: MOV AL, AH OUT DX, AL DEC DX MOV AL, [BX+SI] OUT DX, AL CALL DELAY

ROR AH, 1INC DXDEC BXJNZ DISP1

0111 1111

SI

1. For 8 (eight) times1. Send data through port A2. Select a segment through port B

Page 4: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

7-segment LED Display

MOV BX, 8 ; countMOV AH, 7FH ; selectionMOV SI, OFFSET MEM-1 MOV DX, 01H ; port B

ROR AH, 1INC DXDEC BXJNZ DISP1

DISP1: MOV AL, AH OUT DX, AL DEC DX MOV AL, [BX+SI] OUT DX, AL CALL DELAY

DISP PROC NEAR PUSHF PUSH AX PUSH BX PUSH DX PUSH SI

POP SI POP DX POP BX POP AX POPF RETDISP ENDP

Page 5: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

Stepper Motor Interfaced to the 82C55

0

1

2

4

0011 = 3H 0110 = 6H

1100 = CH 1001 = 9H

Page 6: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

Stepper Motor Interfaced to the 82C55

If CX > 8000H then spin right hand direction else spin left hand direction

Steeper Motor

Page 7: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

If CX > 8000H then spin right hand direction else spin left hand direction

33H / 66H / CCH / 99H

7654 32100011 0011 = 33H0110 0110 = 66H1100 1100 = CCH1001 1001 = 99H

Page 8: Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

References

• Chapter 10.3 The Intel Microprocessors – by Barry B. Brey