| |

VerySource

 Forgot password?
 Register
Search
View: 1266|Reply: 4

Assembly error problem

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-7 03:30:01
| Show all posts |Read mode
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
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-25 14:30:01
| Show all posts
Design principles
  The temperature control system is completed on the 586 microcomputer. Use assembly language to compile the source program. According to the working principle of the A / D converter, the 8-bit binary in the range of 00 ~ FF represents the 0 ~ + 5V thermoelectric potential signal provided by the thermocouple and amplified, and input from the keyboard. According to different thermocouple indexing tables, the digital signal input to the computer is scaled and converted to a temperature value corresponding to the temperature thermoelectric potential and displayed on the computer screen, and heating and heat preservation are given according to the set temperature. And alarm information. Master how to use computer to realize the collection and control output of industrial furnace temperature.
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-7-31 22:00:01
| Show all posts
Haha, it turned out to be X86, and didn't even say anything wrong? Have you read it seriously? I’m sorry, I can’t show it to you. Come on, I’m also a student, I’ll push all the problems and you can help me solve them.
At least you can write your analysis. You can write program comments. This shows that you are sincere, and then others will read it quickly, so they can reply to you. If you give the debugged code directly to you, it won't do much except earn credits for you? This does not seem to be the original intention of verysource...
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-7-31 22:45:01
| Show all posts
It turns out that I was wrong. You have a simple comment. It doesn't seem to be programmer's comment style
I only have masm32 here. I am in a hurry to take the exam and let the later masters correct it. If LZ sees it, write down the wrong place...otherwise it will be difficult to find all the errors for you...
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-8-1 22:00:01
| Show all posts
Laziness is affirmative, but I didn’t say that I just didn’t want to mislead other people. My thoughts have fallen into a dead end (about this procedure), so I only left the title. I hope you have something to say. What, maybe it will help!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list