The subject of the course design, the prawn helps. . .
The purpose of software design is: common in industry-microcomputer temperature control system
The software includes the following:
1. The beginning of the program, including the setting of the scale constant table and the settings of the segments, the allocation of the pre-stored temperature and the storage unit of the calculation results.
2. Input and storage of set temperature and alarm temperature.
3. System initialization.
4. Analog thermoelectric digital signal input.
5. Scale conversion, convert the thermoelectric potential signal to the corresponding decimal temperature value.
6. Temperature display.
7. Preset temperature comparison, and display heating, insulation or alarm respectively according to the comparison result.
Design source program (with errors)
Who helps to see where the error is?
NAME PIPI
; ***** define data segment *****
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
***** defines stack segment ****
STACK SEGMENT PARA STACK 'STACK'
STA1 DB 100 DUP (?)
TOP EQU LENGTH STA1
STACK ENDS
; **** Program initialization *****
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
; **** Show TH string ****
MOV DX, OFFSET TH
MOV AH, 09H
INT 21H
; **** input hold temperature ****
CALL INDA
PUSH BX
MOV DX, OFFSET C4
MOV AH, 09H
INT 21H
; **** output TA string ****
MOV DX, OFFSET TA
MOV AH, 09H
INT 21H
; **** Enter alarm temperature ****
CALL INDA
MOV DX, BX
PUSH DX
;
LEA DX, C4
MOV AH, 09H
INT 21H
; **** Input voltage value ****
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 code to number ******
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
; ****** Read in scale conversion table *******
MOV SI, OFFSET V
COM4: MOV BL, [SI]
CMP AL, BL
JBE CON1
ADD SI, 5
JMP COM4
; ****** Multiplication ******
CON1: MOV BH, [SI-3]
MOV BL, [SI-4]
MUL BX
MOV CL, 8
SHR AX, CL
SHL DX, CL
ADD AX, DX
; ****** Addition operation ******
CON2: MOV BX, [SI-2]
ADC AX, BX
; ****** Hexadecimal Decimal ******
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
; ****** Actual temperature output ******
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
***** Data comparison *****
POP AX
POP DX
POP BX
CMP AX, DX
; ************************************************ *****
JB HOLD
;***Call the police***
MOV DX, OFFSET C3
MOV AH, 09H
INT 21H
JMP EXIT
; *** Continue heating ***
HOLD: CMP BX, AX
JB STOP
MOV DX, OFFSET C2
MOV AH, 9
INT 21H
JMP EXIT
; *** Stop heating ***
STOP: MOV DX, OFFSET C1
MOV AH, 9
INT 21H
; *** program ends ***
EXIT: MOV DX, OFFSET BY
MOV AH, 9
INT 21H
POP DS
MOV AH, 4CH
INT 21H
RET
; *** Data read into subroutine ***
INDA PROC
MOV CX, 4
LEA SI, TA2
; *** Keyboard input of data ***
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
; *** Code to Number of Data ***
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 |