Simple marquee design.
The simulation schematic based on AVR microcontroller is as follows:
The microcontroller source program is as follows:
/********************************************************************
Huicheng Technology
*************************************************************************/
#include /****************************************************************************** Function data type description **************************************************************************/ #define uchar unsigned char #define uint unsigned int /****************************************************************************** MS level delay function program, parameter i delay time **************************************************************************/ void DelayMS(uint i) { uint j; for(;i!=0;i--) { for(j=8000;j!=0;j--); } } /****************************************************************************** The marquee program lights up the corresponding LEDs based on the number of steps run. Low level turns on LED **************************************************************************/ void horse(uchar i) {switch (i) { case 0:PORTA=0X00;break;//0000 0000B turns on LED1~LED8 case 1:PORTA=0X01;break;//0000 0001B turns on LED2~LED8 case 2:PORTA=0X03;break;//0000 0011B turns on LED3~LED8 case 3:PORTA=0X07;break;//0000 0111B turns on LED4~LED8 case 4:PORTA=0X0f;break;//0000 1111B turns on LED5~LED8 case 5:PORTA=0X1f;break;//0001 1111B turns on LED6~LED8 case 6:PORTA=0X3f;break;//0011 1111B turns on LED7~LED8 case 7:PORTA=0X7f;break;//0111 1111B turns on LED8 case 8:PORTA=0Xff;break;//1111 1111B all off default:break; } } /****************************************************************************** Main function **************************************************************************/ void main(void) { uchar i; DDRA=0XFF; //Port setting, PA port is set to push-pull 1 output PORTA=0XFF; PORTA=0XFF; //PORTA is initialized to 1, turn off all LEDs DelayMS(10); while(1) //Program executes unconditionally { for(i=0;i<9;i++) { horse(i); DelayMS(10); //Delay time is about 10MS } ……………………
Previous article:Let the 12864 LCD module display smaller text 5*8 dot matrix
Next article:AVR microcontroller infrared remote control key value decoding experiment
Recommended ReadingLatest update time:2024-11-16 17:33
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- TouchGFX Design Whack-a-Mole
- [Fudan Micro FM33LC046N Review] + Learning UART0 DMA Transmission and Reception
- What are the abbreviations of h and f in the small signal current amplification factor hfe?
- 【Chuanglong TL570x-EVM】Evaluation 05 Linux Application Development Manual
- Soso will take you to IC China 2020
- The 17th International Medical Device Design and Manufacturing Technology Exhibition invites you to participate!
- Open Source ESP32 Color Screen WIFI/BLE Smart Multimeter Production Process (2. Button Selection)
- Number of Cycles At 60Hz
- [McQueen Trial] The first post of the belated post & the bug that the car cannot drive two wheels in reverse at the same time
- [ESP32-C3-DevKitM-1] BLE for ESP32-C3