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.
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [TI recommended course] #Basics of Hall Effect Magnetic Sensors#
- Is the battery level indicator accurate? Battery: I guessed it.
- Would you dare to sit in a car without a steering wheel? The United States allows self-driving cars without steering wheels
- F28335 learning ADC configuration
- Please recommend a step-down circuit
- C6000 Cache
- FPGA_100 Days_Binary to Decimal
- What parameters determine the emission distance of the infrared transmitter tube?
- Msp430PID control motor speed programming example
- A New Decision Feedback Equalizer Architecture Based on FPGA