II) Procedure part:
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define ADC0809 XBYTE[0x7fff]
uchar code SEG7[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar code act[4]={0xfe,0xfd,0xfb,0xf7};
sbit P1_7=P1^7;
sbit P2_6=P2^6;
sbit P3_3=P3^3;
bit flag;
uchar m;
uint X[8];
void d200us(void);
void delay(uint k);
/******************************/
void main(void)
{
TMOD=0x01;
TH0=-(1000/256);
TL0=-(1000%256);
TR0=1;
IE=0x82;
while(1)
{
if(!P2_6){delay(30);if(!P2_6)flag=!flag;delay(300);}
ADC0809=m;
while(!P3_3);
X[m]=ADC0809;
m++;
if(m>7)m=0;
delay(50);
}
}
/************************************/
void delay(uint k)
{
uint i,j;
for(i=0;i
{;}}
}
/***********************************/
void timer0(void) interrupt 1 using 1
{static uchar disbit,n;static uint cnt;
TH0=-(1000/256);
TL0=-(1000%256);
switch(disbit)
{
case 0:{P1=SEG7[n];if(flag)P1_7=1;else P1_7=0;}break;
case 1:{P1=SEG7[(X[n]*49/25)/100];P1_7=1;}break;
case 2:{P1=SEG7[(X[n]*49/25)%100/10];}break;
case 3:{P1=SEG7[(X[n]*49/25)%100%10];}break;
default:break;
}
P2=act[disbit];
disbit++;cnt++;
if(disbit>3)disbit=0;
if(!flag)
{if(cnt>500){cnt=0;n++;}}
if(n>7)n=0;
}
Previous article:DIY 12-channel 315M remote control decoded by 51 single-chip microcomputer
Next article:Single Chip Microcomputer and TCP/IP Network
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- Advantages of WiFi6 compared with other WiFi
- Why does the temperature reading of MAX6675 always have an error of about 2 degrees?
- The problem of resistance and capacitance
- R1
- Which serial port is used for burning Ubuntu?
- Several concepts of ARM simulation JTAG/J-LINK/ULINK/ST-LINK and their differences
- [NXP Rapid IoT Review] Hello Phased Experience
- STM32F103 and MM32F103 experience
- TouchGFX Design + Make a Rubik's Cube (2)
- To achieve the amplification of weak current, the choice of operational amplifier is the key. Generally, it is selected according to the following situations.