I just watched a video about light cube and the term "breathing light" was mentioned one-sidedly. I hurriedly wrote a breathing light program with a digital tube to display the brightness change. The integer frequency is the parameter for adjusting the breathing frequency. The attached figure is a temporary gif file. It will take a while to see the effect./*12Mhz??§????*/
#include
#define uchar unsigned char
#define uint unsigned int
uint f=100; /*????????f????????????1~10khz*/
uint H=6;/*????????·§????????0~10000/f????H>L*/
uint L=0;/*????????·§????????0~10000/f????H>L*/
uchar code wela[]={0xfe,0xfd,0xfb,0xf7};
uchar code dula[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xD8,0x80,0x90};
uint m=0,t;
uchar amp=0,frequency=100;
sbit pwm=P1^7;
sbit pwm_=P1^6;
sbit hkey=P3^5;
sbit lkey=P3^ 3;
void diskey();
void delay(uint z);
void display();
void xunhuan(); void main
()
{
EA=1; ET0 =
1;
TMOD=0x02; TH0
=146;
t=10000/f; RT0
( ) interrupt 1
{ m+; if(H>99)amp=0; if(amp==0)H--; if (H<1)amp=1; delay(frequency); } void delay(uint z) { uint x,y; for(y=z;y>0;y--) for ( x = 12 ; x > 0 ; x-- ); } void display () { delay (2); P2 =dula[H/1000]; P0 = wela [0]; delay (5) ; P0=0xff; P2=dula[H%1000/100]; P0=wela[1]; delay (5 ); P0= 0xff ; P2=dula[H% 100 / 10 ] ;
Previous article:STC12C5A60S2 (ADC query method 10-bit mode) + 1602 display
Next article:51 single chip microcomputer meteor lamp c language source program
- 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
- Servo drive
- C2000 for Sensing and Signal Processing
- μCOS-II Programming Basics
- We spent 2 days to make a small 104 capacitor
- Understanding of Hyperlink Interface in TMS320C6678
- Sell various protocols car ecu
- Does anyone know the official website of Bluetooth Nordic? Please send WeChat or SMS: 13570814011. Thank you!
- CH224K evaluation and solution application
- Wireless sensor node power supply solution
- Motor drive development exchange 1: November questionnaire analysis