1. 程式人生 > >微機原理與介面實驗AD模數轉換

微機原理與介面實驗AD模數轉換

DATA SEGMENT
DATA ENDS
CODE SEGMENT
  ASSUME CS:CODE,DS:DATA
  START:
    PUSH   CS
 POP    DS
    MOV DX,212H
    MOV AL,00H
    OUT DX,AL
    MOV AL,38H
    OUT DX,AL
   
 L: MOV DX,208H 
    OUT DX,AL
    CALL DELAY
    IN AL,DX
    MOV AH,AL
   
    MOV DX,212H
    MOV AL,90H
    OUT DX,AL
   
    MOV AL,AH
    AND AL,0FH
    MOV BX,OFFSET LED
    XLAT
    MOV DX,210H
    OUT DX,AL
   
    MOV AL,AH
    MOV CL,4
    SHR AL,CL
    MOV BX,OFFSET LED
    XLAT
    MOV DX,210H
    OUT DX,AL
    JMP L
   
    DELAY PROC NEAR
      MOV BX,2H
  L2: MOV CX,0FFFH
  L3: LOOP L3
      DEC BX
      JNZ L3
      RET
      DELAY ENDP

LED DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,77H,7CH,39H,5EH,79H,71H 
CODE ENDS
 END   START