1. Experimental tasks
The voltage value is adjusted by an adjustable resistor as the input of the simulated temperature. When the temperature is lower than 30℃, a long beep and light alarm sound, and when the temperature is higher than 60℃, a short beep and light alarm sound. The measured temperature range is 0-99℃.
2. Circuit diagram
Figure 4.29.1
3. Hardware connection on the system board
a) Connect P1.0-P1.7 in the "MCU System" area to the ABCDEFGH ports in the "Dynamic Digital Display" area using an 8-core cable.
b) Connect P2.0-P2.7 in the "MCU System" area and S1S2S3S4S5S6S7S8 ports in the "Dynamic Digital Display" area using an 8-core cable.
c) Connect P3.0 in the "MCU System" area and the ST terminal in the "Analog-to-Digital Conversion Module" area with a wire.
d) Connect P3.1 in the “MCU System” area and the OE terminal in the “Analog-to-Digital Conversion Module” area with a wire.
e) Connect P3.2 in the "MCU System" area and the EOC terminal in the "Analog-to-Digital Conversion Module" area with a wire.
f) Connect P3.3 in the "MCU System" area and the CLK terminal in the "Analog-to-Digital Conversion Module" area with a wire.
g) Connect the A2A1A0 terminals in the "Analog-to-digital conversion module" area to the GND terminal in the "Power module" area with a wire.
h) Connect the IN0 terminal in the "Analog-to-digital conversion module" area to the VR1 terminal in the "Three-way adjustable voltage module" area with a wire.
i) Connect P0.0-P0.7 in the "MCU System" area to the D0D1D2D3D4D5D6D7 terminals in the "Analog-to-Digital Conversion Module" area using an 8-core cable.
j) Use wires to connect P3.6 and P3.7 in the "MCU System" area to L1 and L2 in the "Eight-way LED Indicator Module" area respectively.
k) Connect P3.5 in the "MCU System" area to the SPK IN port in the "Audio Amplifier Module" area with a wire.
l) Plug the SPK OUT in the “Audio Amplifier Module” area into the audio speaker.
4. Assembly source program
(Omitted) [page]
5. C language source program
#include
unsigned char code dispbitcode[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f,0x00};
unsigned char dispbuf[8]={10,10,10,10,10,10,0,0};
unsigned char dispcount;
unsigned char getdata;
unsigned int temp;
unsigned char i;
sbit ST=P3^0;
sbit OE=P3^1;
sbit EOC=P3^2;
sbit CLK=P3^3;
sbit LED1=P3^6;
sbit LED2=P3^7;
sbit SPK=P3^5;
bit lowflag;
bit highflag;
unsigned int cnta;
unsigned int cntb;
bit alarmflag;
void main(void)
{
ST=0;
OE=0;
TMOD=0x12;
TH0=0x216;
TL0=0x216;
TH1=(65536-500)/256;
TL1=(65536-500)%256;
TR1=1;
TR0=1;
ET0=1;
ET1=1;
EA=1;
ST=1;
ST=0;
while(1)
{
if((lowflag==1) &&(highflag==0))
{
LED1=0;
LED2=1;
}
else if((highflag==1) && (lowflag==0))
{
LED1=1;
LED2=0;
}
else
{
LED1=1;
LED2=1;
}
}
}
void t0(void) interrupt 1 using 0
{
CLK=~CLK;
}
void t1(void) interrupt 3 using 0
{
TH1=(65536-500)/256;
TL1=(65536-500)%256;
if(EOC==1)
{
OE=1;
getdata=P0;
OE=0;
temp=getdata*25;
temp=temp/64;
i=6;
dispbuf[0]=10;
dispbuf[1]=10;
dispbuf[2]=10;
dispbuf[3]=10;
dispbuf[4]=10;
dispbuf[5]=10;
dispbuf[6]=0;
dispbuf[7]=0;
while(temp/10)
{
dispbuf[i]=temp%10;
temp=temp/10;
i++;
} [page]
dispbuf[i]=temp;
if(getdata<77)
{
lowflag=1;
highflag=0;
}
else if(getdata>153)
{
lowflag=0;
highflag=1;
}
else
{
lowflag=0;
highflag=0;
}
ST=1;
ST=0;
}
P1=dispcode[dispbuf[dispcount]];
P2=dispbitcode[dispcount];
dispcount++;
if(dispcount==8)
{
dispcount=0;
}
if((lowflag==1) && (highflag==0))
{
cnta++;
if(cnta==800)
{
cnta=0;
alarmflag=~alarmflag;
}
if(alarmflag==1)
{
SPK=~SPK;
}
}
else if((lowflag==0) && (highflag==1))
{
cntb++;
if(cntb==400)
{
cntb=0;
alarmflag=~alarmflag;
}
if(alarmflag==1)
{
SPK=~SPK;
}
}
else
{
alarmflag=0;
cnta=0;
cntb=0;
}
Previous article:Design of Single Chip Microcomputer Digital Frequency Counter
Next article:Design of Bus Intelligent Instrument Temperature Control System
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
- I want to know what device this is.
- [Repost] Understand the difference between PCB and integrated circuit in one article
- SPWM wave generation tool
- How to force the switch state of TI TMS320F28335 EPWM by software
- "Intel SoC FPGA Learning Experience" + My Implementation Method of GDBServer in Lesson 5
- EEWORLD University Hall----Live Replay: The Development and Latest Application of TTI TE Sensors in Industrial Motors
- C6455 CSL_EMIF example
- Application of OPT3004 in battery-powered cameras
- What is the PCB circuit board processing process?
- [NUCLEO-WL55JC2 Review] + Development environment establishment and data preparation