| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 779 人关注过本帖
标题:家用电风扇程序,求指导
只看楼主 加入收藏
鱼双霜
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-12-24
结帖率:0
收藏
 问题点数:0 回复次数:1 
家用电风扇程序,求指导
DATA SEGMENT
    CLOCK0 EQU 290H
    CLKCK1 EQU 291H
    CLOCK2 EQU 292H
    CLOCKC EQU 293H
    PA55 EQU 280H
    PB55 EQU 281H
    PC55 EQU 282H
    P55C EQU 283H
  INTNUM DB 0DH
  MAMES DB 0DH,0AH,0DH,0AH,0DH,0AH,0DH
        DB "****************WELCOME !!!******",0DH,0AH,'$'
  MAMU  DB "1.SET UP SPEED",0DH,0AH
        DB "2.WORKING WITH FLXED STEP",0DH,0AH
        DB "3.CONTINUAL WORKING",0DH,0AH
        DB "4.EXIT",0DH,0AH
  MENU1 DB   0DH,0AH,0DH,0AH
        DB "F6.WORKING SPEED IS 3.75R/S",0DH,0AH
        DB "F7.WORKING SPEED IS 6.25R/S",0DH,0AH
        DB "F8.WORKING SPEED IS 18.75R/S",0DH,0AH
        DB "ESC IS EXIT",0DH,0AH
        DB "***********PLEASE INPUT:$"
  MENU2 DB 0DH,0AH,0DH,0AH
        DB "1.CLOCKWISE",0DH,0AH
        DB "2.ANTI_CLOCKWISE",0DH,0AH
        DB "**************PLEASE INPUT:$"
  MENU3 DB 0DH,0AH,0DH,0AH
        DB "PLEASE INPUT THE NUMBER OF STEP:$"
  MENU4 DB 0DH,0AH,0DH,0AH
        DB "CONTINUAL WORKING !",0DH,0AH
        DB "ESC IS EXIT",0DH,0AH,'$'
  EROMS DB 0DH,0AH
        DB "THE CHOICE IS WORING!PLEASE INPUT AGAIN",'$'
     F0 DB 0DH,0AH
        DB "WORKING SPEED IS:$"
     F6 DB "3.75R/S",0DH,0AH,'$'   
     F7 DB "6.25R/S",0DH,0AH,'$'
     F8 DB "18.75R/S",0DH,0AH,'$'
  SPEDM DW F6,F7,F8
  CLCMS DB 0DH,0AH
        DB "DIRECTION IS CLOCKWISE",0DH,0AH,'$'
  ANTMS DB 0DH,0AH
        DB "DIRECTION IS ANTI_CLOCKWISE",0DH,0AH,'$'
  QUITMS DB "ENTER IS EXIT",0DH,0AH,'$'
  INTSEG DW ?
  INTOFF DW ?
  MCHDC DW STSED,STDIR,ROTFX,CTROT
  SPEDN DW 625,375,125
  SPEED DW 46875
  FLAG1 DB 0
  FLAG0 DB ?
  BUFFER DB 4
         DB ?
         DB 4 DUP (?)
  CW10 DW 10
  INTIMR DB ?
  TURN DB 11001100B
 DATA ENDS
STACK SEGMENT PARA STACK'STACK'
      DB   100 DUP(?)
STACK ENDS
CODE SEGMENT
     ASSUME CS:CODE,DS:DATA,SS:STACK
 MAIN:MOV AX,DATA
      MOV DS,AX
      MOV AH,35H
      MOV AL,0DH
      INT 21H
  MOV INTSEG,ES
  MOV INTOFF,BX
  PUSH DS
  MOV AX,CS
  MOV DS,AX
  MOV DX,OFFSET INTPROC
  MOV AH,25H
  MOV AL,0DH
  INT 21H
  POP DS
  IN AL,21H
  MOV INTIMR,AL
  AND AL,11011111B
  OUT 21H,AL
  MOV DX,CLOCKC
  MOV AL,00110110B
  OUT DX,AL
  MOV DX,P55C
  MOV AL,10000000B
  OUT DX,AL
  STI
OMANU: MOV DX,OFFSET MAMES     ;欢迎界面
       MOV AH,09H
       INT 21H
       MOV DX,OFFSET MAMU     ;STEP选择
       INT 21H
       MOV AH,01H            ;DOS功能调用,键盘输入并回显
       INT 21H
       CMP AL,'1'       ;AL<1
       JB ERROR
       CMP AL,'5'       ;AL>5
       JA ERROR
       JE EXIT
       AND AL,0FH
       DEC AL
       MOV AH,00H
       SHL AX,1
       MOV BX,OFFSET MCHDC
       ADD BX,AX            ;   CALL [BX]
   
       JMP OMANU
  ERROR: MOV DX,OFFSET EROMS
         MOV AH,09H
         INT 21H
         JMP OMANU
 EXIT: MOV AL,INTIMR
       OUT 21H,AL
       PUSH DS
       MOV DX,INTOFF
       MOV AX,INTSEG
       MOV DS,AX
       MOV AH,25H
       MOV AL,00H
       INT 21H
       POP DS
       MOV AH,4CH
       INT 21H
 STSED PROC NEAR
       PUSH AX
       PUSH DX
       PUSH BX
OMENU1: MOV DX,OFFSET MENU1      ;风速选择
        MOV AH,09H           ;显示字符串
        INT 21H
        MOV AH,00H
        INT 16H         ;错误类型码
        CMP AL,1BH
        JZ EXIT        ;相等
        CMP AH,59
        JB ERROR1     ;AH<59
        CMP AH,66
        JA ERROR1    ;AH>66
        SUB AH,59
        MOV BH,0
        MOV BL,AH
        SHL BL,1
        MOV AX,SPEDN[BX]
        MOV SPEED,AX
        MOV DX,OFFSET F0
        MOV AH,09H
        INT 21H
        MOV DX,SPEDM[BX]
        INT 21H
        JMP EXIT
ERROR1: MOV DL,0AH
        MOV AH,02H
        INT 21H
    MOV DL,0DH
    INT 21H
    MOV DX,OFFSET EROMS
    MOV AH,09H
    INT 21H
    JMP OMENU1
EXIT1: POP BX
       POP DX
       POP AX
       RET
  STSED ENDP
  STDIR PROC NEAR     ;子程序STDIR
        PUSH DX
        PUSH AX
OMENU2: MOV DX,OFFSET MENU2
        MOV AH,09H
        INT 21H
        MOV AH,01H
        INT 21H
        CMP AL,1BH     ;1BH-27-ESC
        JE EXIT2
        CMP AL,'1'
        JE CLFLG     ;AL=1,CLOCKWISE
        CMP AL,'2'
        JE ANTFLG
        MOV DX,OFFSET EROMS
        MOV AH,09H
        INT 21H
        JMP OMENU2
 CLFLG: MOV FLAG1,0
        MOV DX,OFFSET CLCMS
        MOV AH,09H
        INT 21H
        JMP EXIT2
 ANTFLG: MOV FLAG1,1
         MOV DX,OFFSET ANTMS
         MOV AH,02H
         INT 21H
         JMP EXIT2
  EXIT2: POP AX
         POP DX
         RET
    STDIR ENDP
 ROTFX PROC NEAR
       PUSH DX
       PUSH CX
       PUSH BX
       PUSH AX
       PUSH SI
 OMENU3: MOV DX,OFFSET MENU3
         MOV AH,09H
         INT 21H
         MOV DX,OFFSET BUFFER
         MOV AH,0AH
         INT 21H
         MOV CL,BUFFER[1]
         CMP CL,3
         JA ERROR3
         LEA SI,BUFFER
         ADD SI,2
         MOV CH,00H
         MOV AX,00H
 NEXT: MUL CW10
       MOV BL,[SI]
       AND BX,000FH
       ADD AX,BX
       INC SI
       LOOP NEXT
       MOV CX,AX
       MOV FLAG0,0
       MOV DX,CLOCK0
       MOV AX,SPEED
       OUT DX,AL
       MOV AL,AH
       OUT DX,AL
       MOV DX,PA55     ; MOV AL,OFFH
       OUT DX,AL
       STI
 AGAIN1: CMP CX,00H
        JE EXIT3
        MOV AH,06H
        MOV DL,0FFH
        INT 21H
        CMP AL,1BH
        JE EXIT3
        CMP FLAG0,0
        JE AGAIN1
        DEC CX
        MOV FLAG0,0
        JMP AGAIN1
 ERROR3: MOV DX,OFFSET EROMS
         MOV AH,09H
         INT 21H
         JMP OMENU3
 EXIT3: CLI
        MOV DX,PA55
        MOV AL,00H
        OUT DX,AL
        POP SI
        POP AX
        POP BX
        POP CX
        POP DX
        RET
  ROTFX ENDP
  
  CTROT PROC NEAR     ;子程序CTROT
        PUSH DX
        PUSH AX
        MOV DX,OFFSET MENU4
        MOV AH,09H
        INT 21H
        MOV DX,CLOCK0
        MOV AX,SPEED
        OUT DX,AL
        MOV AL,AH
        OUT DX,AL
        MOV DX,PA55    ;   MOV AL,OFFH
        OUT DX,AL
        STI
 AGAIN2: MOV AH,06H      ; MOV DL,OFFH
         INT 21H
         CMP AL,1BH
         JNE AGAIN2
         CLI
         MOV DX,PA55
         MOV AL,00H
         OUT DX,AL
         POP AX
         POP DX
         RET
   CTROT ENDP
INTPROC PROC            ;子程序INTPROC
        PUSH AX
        PUSH BX
        PUSH CX
        PUSH DX
        PUSH DS
        MOV AX,DATA
        MOV DS,AX
        STI
        MOV DX,PC55
        MOV AL,TURN
        OUT DX,AL
        CMP FLAG1,0
        JE TNCLC
        ROL AL,1
        JMP EXITI
 TNCLC: ROR AL,1
 EXITI: MOV TURN,AL
        MOV FLAG0,1
        CLI
        MOV AL,20H      ;OUT 2OH,AL
      
        POP DS
        POP DX
        POP CX
        POP BX
        POP AX
        IRET
 INTPROC ENDP
CODE ENDS
    END MAIN
搜索更多相关主题的帖子: 电风扇 
2013-12-25 15:50
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:400
帖 子:11857
专家分:43421
注 册:2006-5-13
收藏
得分:0 
是在单片机上用的吧?

活到老,学到老!http://www.(该域名已经被ISP盗卖了)E-mail:hu-jj@
2013-12-29 14:17
快速回复:家用电风扇程序,求指导
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050830 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved