80 likes | 169 Vues
Lecture 14 Basic I/O Interface. Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU. 7-segment LED Display. 00H – 03H are the I/O ports 7654 3210 0000 0000 Port A 0000 0001 Port B 0000 0010 Port C 0000 0011 Command Register. MEM. 5 6 4 2 8 9 0 1. For 8 (eight) times
E N D
Lecture 14Basic I/O Interface Presented By Dr. ShazzadHosain Asst. Prof. EECS, NSU
7-segment LED Display 00H – 03H are the I/O ports 7654 3210 0000 0000 Port A 0000 0001 Port B 0000 0010 Port C 0000 0011 Command Register MEM 5 6 4 2 8 9 0 1 • For 8 (eight) times • Send data through port A • Select a segment through port B OUT PORT, DATA OUT DX, AL
7-segment LED Display 00H – 03H are the I/O ports 7654 3210 0000 0000 Port A 0000 0001 Port B 0000 0010 Port C 0000 0011 Command Register MEM 5 6 4 2 8 9 0 1 SI 0111 1111 DISP1: MOV AL, AH OUT DX, AL DEC DX MOV AL, [BX+SI] OUT DX, AL CALL DELAY ROR AH, 1 INC DX DEC BX JNZ DISP1 MOV BX, 8 ; count MOV AH, 7FH ; selection MOV SI, OFFSET MEM-1 MOV DX, 01H ; port B • For 8 (eight) times • Send data through port A • Select a segment through port B
7-segment LED Display DISP PROC NEAR PUSHF PUSH AX PUSH BX PUSH DX PUSH SI POP SI POP DX POP BX POP AX POPF RET DISP ENDP DISP1: MOV AL, AH OUT DX, AL DEC DX MOV AL, [BX+SI] OUT DX, AL CALL DELAY ROR AH, 1 INC DX DEC BX JNZ DISP1 MOV BX, 8 ; count MOV AH, 7FH ; selection MOV SI, OFFSET MEM-1 MOV DX, 01H ; port B
Stepper Motor Interfaced to the 82C55 0011 = 3H 1 0110 = 6H 2 0 4 1001 = 9H 1100 = CH
Stepper Motor Interfaced to the 82C55 Steeper Motor If CX > 8000H then spin right hand direction else spin left hand direction
If CX > 8000H then spin right hand direction else spin left hand direction 7654 3210 0011 0011 = 33H 0110 0110 = 66H 1100 1100 = CCH 1001 1001 = 99H 33H / 66H / CCH / 99H
References • Chapter 10.3 The Intel Microprocessors – by Barry B. Brey