Industrial Sequential Control Based on 8031 ​​Design

Publisher:TranquilSilenceLatest update time:2011-11-16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Master the simple programming of industrial sequential control programs and the use of interrupts.
Experimental content
1. Experimental principle diagram:



2. Experimental content
P1.0-P1.6 of 8032 controls the seven processes of the injection molding machine. Now simulate the control of the lighting of seven light-emitting diodes. The high level is effective. Set the time of each process to delay. P3.4 is the start switch, which is started at a low level. P3.3 is the external fault input analog switch. When P3.3 is 0, it will continuously alarm. P1.7 is the alarm sound output. Set the 6th process to have only one output and the 7th process to have three outputs.
3. Experimental description
In the experiment, external interrupt 0 is used. The key to compiling the interrupt service program is:
(1) Protect the state when entering the interrupt and restore the entry state before exiting the interrupt.
(2) Whether to allow interrupt reentry must be set in the interrupt program, that is, set the EX0 bit.
Generally, when entering the interrupt program, PSW, ACC and registers used by the interrupt program but not dedicated to it should be protected. This is not involved in this experiment.
3. Program
Program list:
ORG 0013H
LJMP HA2S3
ORG 0580H
HA2S: MOV P1, #07FH
ORL P3, #00H
HA2S1: JNB P3.4, HA2S1
ORL IE, #84H
ORL IP, #04H
MOV PSW, #00H
MOV SP, #53H
HA2S2: MOV P1, #07EH
ACALL HA2S7
MOV P1,#07DH
ACALL HA2S7
MOV P1,#07BH
ACALL HA2S7
MOV P1,#077H
ACALL HA2S7
MOV P1,#06FH
ACALL HA2S7
MOV P1,#05FH
ACALL HA2S7
MOV P1,#03FH
ACALL HA2S7
SJMP HA2S2
HA2S3: MOV B,R2
HA2S4: MOV P1,#07FH
MOV 20H,#0A0H
HA2S5: SETB P1.7
ACALL HA2S6
CLR P1.7
ACALL HA2S6
DJNZ 20H,HA2S5
CLR P1.7
ACALL HA2S6
JNB P3.2,HA2S4
MOV R2,B
RETI
HA2S6: MOV R2,#06 H
ACALL DELAY
RET
HA2S7: MOV R2,#30H
ACALL DELAY
RET
DELAY: PUSH 02H
DELAY1: PUSH 02H
DELAY2: PUSH 02H
DELAY3: DJNZ R2,DELAY3
POP 02H
DJNZ R2,DELAY2
POP 02H
DJNZ R2,DELAY1
POP 02H
DJNZ R2, DELAY
RET
END
IV. Experimental steps
① Connect P3.4 to K1, P3.2 to K2, P1.0-P1.6 to L1-L7 respectively, and P1.7 to SIN (electronic audio input terminal).
② Turn the K1 switch to the top, and K2 to the top.
③ Run the program from the starting address 0580H in a continuous manner (enter 0580 and press the EXEC key). At this time, it should be in the waiting state.
④ Turn K1 to the bottom (display low level), and each process should run normally.
⑤ Turn K2 to the bottom (low level), and there should be a sound alarm (artificially set fault).
⑥ Turn K2 to the top (high level), that is, the fault is eliminated, and the program should continue to execute from the process that just alarmed.

Reference address:Industrial Sequential Control Based on 8031 ​​Design

Previous article:Design of Human-Computer Interaction System Based on 51 Single-Chip Microcomputer and FPGA
Next article:Design of multi-channel calling system based on MCS-51 single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 17:37

Detailed process and program example of 8031 ​​single-chip CPU responding to interrupt source request
The MCS-51 CPU checks each interrupt source sequentially in each machine cycle, samples and processes all activated interrupt requests in priority order in the state cycle S6 of each machine cycle, and responds to the activated highest-level interrupt request in the state cycle S1 of the next machine cycle if not bloc
[Microcontroller]
Detailed process and program example of 8031 ​​single-chip CPU responding to interrupt source request
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号