课程设计的题目,那位大虾帮忙看看。。。
软件设计的用途是:工业中常见的--微机温度控制系统
软件包括下面内容:
1.程序开头,包括标度变换常量表的设置和各段的设置,各项预制温度和运算结果的存放单元分配。
2.设定温度,报警温度的输入和存放。
3.系统初始化。
4.模拟热电势数字信号输入。
5.标度变换,将热电势信号转换为相应的十进制温度值。
6.温度显示。
7.预设温度比较,并根据比较结果分别显示加热,保温或者报警。
设计源程序(有错误)
那位帮忙看看错误在那里?
NAME PIPI
;*****定义数据段*****
DATA SEGMENT PARA 'DATA'
V DB 00H,00H,05H,00H,00H
DB 15H,0C3H,04H,00H,00H
DB 29H,00H,05H,0FBH,0FFH
DB 3EH, 0C3H,04H,05H,00H
DB 54H,8BH,04H,12H,00H
DB 69H,0C3H,04H,00H,00H
DB 7FH,8BH,04H,16H,00H
DB 95H,8BH,04H,16H,00H
DB 0AAH,0C3H,04H,16H,00H
DB 0BEH,00H,05H,0CEH,0FFH
DB 0C2H,00H,05H,1EH,00H
DB 0E6H,00H,05H,0CEH,0FFH
DB 0F9H,43H,05H,92H,0FFH
DB 0FFH
TH DB 'INPUT THE HOLD TEMP:',0AH,0DH,'$'
TA DB 'INPUT THE ALARM TEMP:',0AH,0DH,'$'
V1 DB 'INPUT THE VOLT:',0AH,0DH,'$'
BY DB 'THANK FOR YOU USED',0AH,0DH,'$'
TE DB 'THE TEMP IS:',0AH,0DH,'$'
C1 DB 'STOP HEATING.',0AH,0DH,'$'
C2 DB 'HEATING',0AH,0DH,'$'
C3 DB 'DAGER RAN AWAY', 0AH, 0DH,'$'
C4 DB ' ',0AH,0DH,'$'
RE DB 0,0,0,0
V2 DB 0,0
TH2 DB 0,0,0,0
TA2 DB 0,0,0,0
DATA ENDS
;*****定义堆栈段****
STACK SEGMENT PARA STACK 'STACK'
STA1 DB 100 DUP(?)
TOP EQU LENGTH STA1
STACK ENDS
;****程序初始化*****
CODE SEGMENT PARA 'CODE'
ASSUME CS:CODE, DS:DATA
ASSUME SS:STACK, ES:DATA
STAR PROC FAR
MOV AX,DATA
MOV DS, AX
MOV ES, AX
MOV AX, STACK
MOV SS, AX
MOV AX, TOP
MOV SI, AX
;****显示TH字符串****
MOV DX, OFFSET TH
MOV AH, 09H
INT 21H
;****输入保持温度****
CALL INDA
PUSH BX
MOV DX, OFFSET C4
MOV AH, 09H
INT 21H
;****输出TA字符串****
MOV DX, OFFSET TA
MOV AH, 09H
INT 21H
;****输入报警温度****
CALL INDA
MOV DX, BX
PUSH DX
;
LEA DX,C4
MOV AH, 09H
INT 21H
;****输入电压值****
MOV DX, OFFSET V1
MOV AH, 09H
INT 21H
;
LEA SI, V2
XOR CX, CX
MOV CX, 2
INV1: MOV AH, 1
INT 21H
MOV[SI], AL
INC SI
LOOP INV1
XOR AH, AH
LEA SI, V2
MOV BX, 2
;
COM1: MOV CL, [SI]
;**********************************************
CMP CL, 40h
JC COM2
SUB CL,37H
MOV [SI],CL
INC SI
DEC BX
CMP BX,00H
JZ COM3
JMP COM1
;******ASCII码转数字******
COM2: SUB CL,30H
MOV [SI],CL
INC SI
DEC BX
CMP BX,00H
JZ COM3
JMP COM1
COM3: LEA SI,V2
MOV AL,[SI]
MOV CL,4
SHL AL,CL
MOV BL,[SI+1]
ADD AL,BL
;******标度转换表读入*******
MOV SI,OFFSET V
COM4: MOV BL,[SI]
CMP AL,BL
JBE CON1
ADD SI,5
JMP COM4
;******乘法运算******
CON1: MOV BH,[SI-3]
MOV BL,[SI-4]
MUL BX
MOV CL,8
SHR AX,CL
SHL DX,CL
ADD AX,DX
;******加法运算******
CON2: MOV BX,[SI-2]
ADC AX,BX
;******十六进制转换十进制******
MOV BL,10
DIV BL
LEA SI,TH2
MOV [SI+3],AH
XOR AH,AH
DIV BL
MOV [SI+2],AH
XOR AH,AH
DIV BL
MOV [SI+1],AH
MOV [SI],AL
MOV CL,4
MOV AH,[SI]
SHL AH,CL
ADD AH,[SI+1]
MOV AL,[SI+2]
SHL AL,CL
ADD AL,[SI+3]
PUSH AX
;
MOV DX,OFFSET C4
MOV AH,9
INT 21H
;******实际温度输出******
MOV DX,OFFSET TE
MOV AH,9
INT 21H
MOV CX,4
LEA SI,TH2
TN1: MOV AL,[SI]
ADD AL,30H
MOV [SI],AL
INC SI
LOOP TN1
LEA SI,TH2
MOV CX,4
TN2: MOV DL,[SI]
MOV AH,2
INT 21H
INC SI
LOOP TN2
LEA DX,C4
MOV AH,9
INT 21H
;*****数据比较*****
POP AX
POP DX
POP BX
CMP AX,DX
;******************************************************
JB HOLD
;***报警***
MOV DX,OFFSET C3
MOV AH,09H
INT 21H
JMP EXIT
;***继续加热***
HOLD:CMP BX,AX
JB STOP
MOV DX,OFFSET C2
MOV AH,9
INT 21H
JMP EXIT
;***停止加热***
STOP:MOV DX,OFFSET C1
MOV AH,9
INT 21H
;***程序结束***
EXIT:MOV DX,OFFSET BY
MOV AH,9
INT 21H
POP DS
MOV AH,4CH
INT 21H
RET
;***数据读入子程序***
INDA PROC
MOV CX,4
LEA SI,TA2
;***数据的键盘输入***
IN1:MOV AH,1
INT 21H
MOV [SI],AL
INC SI
LOOP IN1
XOR AX,AX
MOV CX,4
LEA SI,TA2
IN2:MOV AL,[SI]
CMP AL,40H
JAE IN1
MOV AL,[SI+1]
CMP AL,40H
JAE IN1
MOV AL,[SI+2]
CMP AL,40H
JAE IN1
MOV AL,[SI+3]
CMP AL,40H
JAE IN1
;***数据的码转数字***
SUB AL,30H
MOV [SI],AL
INC SI
LOOP IN2
XOR AX,AX
XOR BX,BX
MOV CL,4
LEA SI,TA2
MOV AH,[SI]
SHL AH,CL
MOV BH,[SI+1]
ADD AH,BH
MOV AL,[SI+2]
SHL AL,CL
MOV BL,[SI+3]
ADD AL,BL
MOV BX,AX
RET
INDA ENDP
STAR ENDP
CODE ENDS
END STAR
|