//Chip ATMEGA16L
//Clock 4MHz internal
//Written in CVAVR, using the system's own delay function
//PD0 PD1 simulate 164 timing
#include
#include
#define hc164_data
#define hc164_clk PORTD.1
void led164_display (void); // Digital tube display
void hc164_send_byte (unsigned char byte);
unsigned char ledxs[8] = {1,2,3,4,5,6,7,8}; // Digital tube display buffer 1
unsigned char ledxs2[8] = {0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0,17}; // Digital tube display buffer 2
flash unsigned char tab[] = {0xb7,0x12,0x67,0x76,0xd2,0xf4,0xf5,0x16,0xf7,0xf6,0xd7,0xf1,0xa5,0x73,0xe5,0xc5,0,0xff};
//Common cathode code 0-F, all off, all on
void main(void)
{
delay_ms(200);
PORTD = 0xFF;
DDRD = 0xFF; //PD outputwhile
(1)
{
led164_display ();
}
}
void hc164_send_byte (unsigned char byte)
{
unsigned char i;
for(i=0;i<8;i++)
{
hc164_data
hc164_clk = 1;
hc164_clk = 0;
}
}
void led164_display (void)
{
unsigned char i;
for(i=0;i<8;i++)
{
hc164_send_byte ( tab[ ledxs[i] ]);
delay_ms(1);
}
delay_ms(2000);
for(i=0;i<8;i++)
{
hc164_send_byte ( tab[ ledxs2[i] ]);
delay_ms(1);
delay_ms
(2000);
}
Previous article:CVAVR Program for TLC5615
Next article:12864 (with font library) serial mode display Chinese characters and font library - CVAVR program
Recommended ReadingLatest update time:2024-11-16 12:50
- Popular Resources
- Popular amplifiers
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
- Pressure sensor problem
- [Popular Science] What is an attenuator? How to use an attenuator?
- Using FPGA to implement optimized fingerprint recognition preprocessing algorithm.pdf
- There is a new IoT product project that is about to be launched, but the definitions of the parameters of the Bluetooth chip NRF52832 are not yet clear,...
- [Io Development Notes] Gizwits Smart Watering Device Practice (3) - Automatically Generate Code Transplantation
- MSP430 Series Embedded Experiment Tutorial---Basics
- Which of the current mainstream smart home wireless protocols is better?
- About MicroPython ESP8266 WIFI settings problem - thanks!
- [STM32WB55 review]——by freebsder
- DSP 28335