Note: P1^6 and P1^7 are two function keys. P1^6 is the cascade end of the low-pass filter. When it is pressed, the other keys are pressed at the same time to connect the low-pass of each amplifier.
It is also a combination key for high-pass filter. Actually, this circuit is a key-controlled amplifier, which is mainly adjustable in 10dB steps and has LCD display. The following is the program in Keil:
#include
sbit lcdrs=P2^6;
sbit lcden=P2^7;
sbit lcdrw=P2^5;
sbit D10=P1^0;
sbit D20=P1^1;
sbit D30=P1^2;
sbit D40=P1^3;
sbit D50=P1^4;
sbit D60=P1^5;
sbit lwchose=P1^6;
sbit hgchose=P1^7;
char code temp0[]="20LogAu=10dB";
char code temp1[ ]="20LogAu=20dB";
char code temp2[]="20LogAu=30dB";
char code temp3[]="20LogAu=40dB";
char code temp4[]="20LogAu=50dB";
char code temp5[]="20LogAu=60dB";
char code templ0[]="lw_10dB";
char code templ1[]="lw_20dB";
char code templ2[]="lw_30dB ";
char code templ3[]="lw_40dB";
char code templ4[]="lw_50dB";
char code templ5[]="lw_60dB";
char code temph0[]="hg_10dB";
char code temph1[]="hg_20dB ";
char code temph2[]="hg_30dB";
char code temph3[]="hg_40dB";
char code temph4[]="hg_50dB";
char code temph5[]="hg_60dB";
char num;
void delay(int z);
void write_com(char com)// Instruction sub-function
{
lcdrs=0;
lcdrw=0;
P0=com;
delay(5);
lcden=1 ;
delay(5);
lcden=0;
lcdrw=1;
lcdrs=1;
}
void write_data(char datae) // data sub-function
{
lcdrs=1;
lcdrw=0;
P0=datae;
delay(5);
lcden= 1;
delay(5);
lcden=0;
sbit lcdrs=P2^6;
sbit lcden=P2^7;
sbit lcdrw=P2^5;
sbit D10=P1^0;
sbit D20=P1^1;
sbit D30=P1^2;
sbit D40=P1^3;
sbit D50=P1^4;
sbit D60=P1^5;
sbit lwchose=P1^6;
sbit hgchose=P1^7;
char code temp0[]="20LogAu=10dB";
char code temp1[ ]="20LogAu=20dB";
char code temp2[]="20LogAu=30dB";
char code temp3[]="20LogAu=40dB";
char code temp4[]="20LogAu=50dB";
char code temp5[]="20LogAu=60dB";
char code templ0[]="lw_10dB";
char code templ1[]="lw_20dB";
char code templ2[]="lw_30dB ";
char code templ3[]="lw_40dB";
char code templ4[]="lw_50dB";
char code templ5[]="lw_60dB";
char code temph0[]="hg_10dB";
char code temph1[]="hg_20dB ";
char code temph2[]="hg_30dB";
char code temph3[]="hg_40dB";
char code temph4[]="hg_50dB";
char code temph5[]="hg_60dB";
char num;
void delay(int z);
void write_com(char com)// Instruction sub-function
{
lcdrs=0;
lcdrw=0;
P0=com;
delay(5);
lcden=1 ;
delay(5);
lcden=0;
lcdrw=1;
lcdrs=1;
}
void write_data(char datae) // data sub-function
{
lcdrs=1;
lcdrw=0;
P0=datae;
delay(5);
lcden= 1;
delay(5);
lcden=0;
}
void init()
{
lcden=0;
write_com(0x06); // Input mode setting
write_com(0x0c);
void init()
{
lcden=0;
write_com(0x06); // Input mode setting
write_com(0x0c);
write_com(0x14);
write_com(0x01); //Clear screen
write_com(0x02); //Reset
write_com(0x02); //Reset
}
void main()
{
init();
lab: while (1)
{
if (D10==0)
{
write_com(0x01); //Clear screen
P3=0x22;
for(num=0;num<12;num++)
{
write_data(temp0[num]);
delay(5);
}
write_com(0x80+10);
goto lab;
void main()
{
init();
lab: while (1)
{
if (D10==0)
{
write_com(0x01); //Clear screen
P3=0x22;
for(num=0;num<12;num++)
{
write_data(temp0[num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D20==0)
{
write_com(0x01); //Clear screen
P3=0x0a;
for(num=0;num<12;num++)
{
write_data(temp1[num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D30==0)
{
write_com(0x01); //Clear screen
P3=0x02;
for(num=0;num<12;num++)
{
write_data(temp2[ num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D40==0)
{
write_com(0x01); //Clear screen
P3=0x04;
for(num=0;num <12;num++)
{
write_data(temp3[num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D50==0)
{
write_com(0x01); //Clear screen
P3=0x08;
for(num=0;num<12;num++)
{
write_data(temp4[num]);
delay(5);
}
write_com(0x80 +10);
goto lab;
}
else if (D60==0)
{
write_com(0x01); //Clear screen
P3=0x00;
for(num=0;num<12;num++)
{
write_data(temp5[num]) ;
delay(5);
}
write_com(0x80+10);
goto lab;
}
TAB1: if (lwchose==0)
{
if (D10==0)
{
delay(5);
if (D10==0)
{
write_com (0x01); //Clear screen
P3=0x7a;
for(num=0;num<7;num++)
{
write_data(templ0[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D20==0)
{
delay(5);
if (D20==0)
{
write_com(0x01); //Clear screen
P3=0x6a;
for( num=0;num<7;num++)
{
write_data(templ1[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D30==0)
{
delay(5) ;
if (D30==0)
{
write_com(0x01); //Clear screen
P3=0x62;
for(num=0;num<7;num++)
{
write_data(templ2[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D40==0)
{
delay(5);
if (D40==0)
{
write_com (0x01); //Clear screen
P3=0x64;
for(num=0;num<7;num++)
{
write_data(templ3[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D50==0)
{
delay(5);
if (D50==0)
{
write_com(0x01); //Clear screen
P3=0x68;
for(num=0;num<7;num++)
{
write_data (templ4[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D60==0)
{
delay(5);
if (D60==0)
{
write_com(0x01); //Clear screen
P3=0x60;
for(num=0;num<7;num++)
{
write_data(templ5[num]);
delay( 5);
}
write_com(0x80+10);
goto TAB1;
}
}
}
TAB2: if (hgchose==0)
{
if (D10==0)
{
delay(5);
if (D10==0)
{
write_com( 0x01); //Clear screen
P3=0x3a;
for(num=0;num<7;num++)
{
write_data(temph0[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if (D20==0)
{
delay(5);
if (D20==0)
{
write_com(0x01); //Clear screen
P3=0x2a;
for(num=0;num<7;num++)
{
write_data(temph1[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if ( D30==0)
{
delay(5);
if (D30==0)
{
write_com(0x01); //Clear screen
P3=0x22;
for(num=0;num<7;num++)
{
write_data(temph2[num ]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if (D40==0)
{
delay(5);
if (D40==0)
{
write_com(0x01); //Clear screen
P3=0x24;
for(num=0;num<7; num++)
{
write_data(temph3[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if (D50==0)
{
delay(5);
if (D50==0)
{
write_com(0x01); //Clear screen
P3=0x28;
for(num=0;num<7;num++)
{
write_data(temph4[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2 ;
}
}
else if (D60==0)
{
delay(5);
if (D60==0)
{
write_com(0x01); //Clear screen
P3=0x20;
for(num=0;num<7;num++)
{
write_data(temph5[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
}
}
else if (D20==0)
{
write_com(0x01); //Clear screen
P3=0x0a;
for(num=0;num<12;num++)
{
write_data(temp1[num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D30==0)
{
write_com(0x01); //Clear screen
P3=0x02;
for(num=0;num<12;num++)
{
write_data(temp2[ num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D40==0)
{
write_com(0x01); //Clear screen
P3=0x04;
for(num=0;num <12;num++)
{
write_data(temp3[num]);
delay(5);
}
write_com(0x80+10);
goto lab;
}
else if (D50==0)
{
write_com(0x01); //Clear screen
P3=0x08;
for(num=0;num<12;num++)
{
write_data(temp4[num]);
delay(5);
}
write_com(0x80 +10);
goto lab;
}
else if (D60==0)
{
write_com(0x01); //Clear screen
P3=0x00;
for(num=0;num<12;num++)
{
write_data(temp5[num]) ;
delay(5);
}
write_com(0x80+10);
goto lab;
}
TAB1: if (lwchose==0)
{
if (D10==0)
{
delay(5);
if (D10==0)
{
write_com (0x01); //Clear screen
P3=0x7a;
for(num=0;num<7;num++)
{
write_data(templ0[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D20==0)
{
delay(5);
if (D20==0)
{
write_com(0x01); //Clear screen
P3=0x6a;
for( num=0;num<7;num++)
{
write_data(templ1[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D30==0)
{
delay(5) ;
if (D30==0)
{
write_com(0x01); //Clear screen
P3=0x62;
for(num=0;num<7;num++)
{
write_data(templ2[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D40==0)
{
delay(5);
if (D40==0)
{
write_com (0x01); //Clear screen
P3=0x64;
for(num=0;num<7;num++)
{
write_data(templ3[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D50==0)
{
delay(5);
if (D50==0)
{
write_com(0x01); //Clear screen
P3=0x68;
for(num=0;num<7;num++)
{
write_data (templ4[num]);
delay(5);
}
write_com(0x80+10);
goto TAB1;
}
}
else if (D60==0)
{
delay(5);
if (D60==0)
{
write_com(0x01); //Clear screen
P3=0x60;
for(num=0;num<7;num++)
{
write_data(templ5[num]);
delay( 5);
}
write_com(0x80+10);
goto TAB1;
}
}
}
TAB2: if (hgchose==0)
{
if (D10==0)
{
delay(5);
if (D10==0)
{
write_com( 0x01); //Clear screen
P3=0x3a;
for(num=0;num<7;num++)
{
write_data(temph0[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if (D20==0)
{
delay(5);
if (D20==0)
{
write_com(0x01); //Clear screen
P3=0x2a;
for(num=0;num<7;num++)
{
write_data(temph1[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if ( D30==0)
{
delay(5);
if (D30==0)
{
write_com(0x01); //Clear screen
P3=0x22;
for(num=0;num<7;num++)
{
write_data(temph2[num ]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if (D40==0)
{
delay(5);
if (D40==0)
{
write_com(0x01); //Clear screen
P3=0x24;
for(num=0;num<7; num++)
{
write_data(temph3[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
else if (D50==0)
{
delay(5);
if (D50==0)
{
write_com(0x01); //Clear screen
P3=0x28;
for(num=0;num<7;num++)
{
write_data(temph4[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2 ;
}
}
else if (D60==0)
{
delay(5);
if (D60==0)
{
write_com(0x01); //Clear screen
P3=0x20;
for(num=0;num<7;num++)
{
write_data(temph5[num]);
delay(5);
}
write_com(0x80+10);
goto TAB2;
}
}
}
}
}
void delay(int z)
{
int x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
void delay(int z)
{
int x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
Previous article:Modular programming of microcontroller in Keil
Next article:Initial STC89C52RC microcontroller experiment
- Popular Resources
- Popular amplifiers
- Linux lcd_display_font tutorial
- Research on control algorithm and program design of intelligent tracking car_Technical report of the first \"Freescale\" Cup National College Student Intelligent Car Invitational Competition
- Design of voice/text message wireless transmitter
- v4l2 acquisition and display program
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- Apprentice
- 【ST NUCLEO-G071RB Review】TIM-Basic timers
- msp430 program upgrade
- TouchGFX design by ddllxxrr
- As the party A, it's a bit painful...
- Internal structure of ESP8266 chip
- EEWORLD University ---- Tektronix uses mixed signal oscilloscope to explore the secrets of the bus
- Why choose 120Ω? The terminal resistance value recommended by the CAN standard
- Is there any sensor expert?
- About New Energy Vehicle Mode 2 IC-CPD Charging Gun Type A Leakage Current Sensor