Experiment name: LED dot matrix experiment (light up one point)
Wiring instructions:
Experimental phenomenon: After downloading the program, the 8*8 LED dot matrix lights up the first point in the upper left corner.
Note: The J24 yellow jumper cap next to the LED dot matrix is short. Connect to the GND end
************************************************ *****************************************/
#include "reg51.h"
typedef unsigned int u16; //Redefine the system default data type
typedef unsigned char u8;
//Define 74HC595 control pin
sbit SRCLK=P3^6; //Shift register clock input
sbit RCLK=P3^5; //Storage register clock input
sbit SER=P3^4; //Serial data input
#define LEDDZ_COL_PORT P0 //Point array control port
/****************************************************** ****************************
* Function name: delay_10us
* Function function: Delay function, when ten_us=1, the delay is approximately 10us
* Input: ten_us
* Output: None
**************************************** ***************************************/
void delay_10us(u16 ten_us)
{
while(ten_us --);
}
/****************************************************** ******************************
* Function name: hc595_write_data(u8 dat)
* Function function: Write one byte to 74HC595 data
* input: dat:data
* output: none
****************************************** *****************************************/
void hc595_write_data(u8 dat)
{
u8 i=0;
for(i=0;i<8;i++)//Loop 8 times to write a byte into the register
{ SER=dat>>7;//Transmit the high-order dat
of a byte first
<<=1;//Move the low bit to the high bit
SRCLK=0;
delay_10us(1);
SRCLK=1;
delay_10us(1);//The rising edge of the shift register clock sends the port data into the register
}
RCLK=0;
delay_10us(1);
RCLK=1;//The rising edge of the storage register clock will output the data previously written to the register
}
/****************************************************** ******************************
* Function name: main
* Function function: main function
* Input: None
* Output: None
* *************************************************** ****************************/
void main()
{
u8 i=0;
LEDDZ_COL_PORT=0x7f;//Set the first column on the left side of the LED dot matrix to 0, that is, the LED cathode is low level, and the remaining columns are 1, that is, high level
while(1)
{
hc595_write_data(0x80);//Set the LED dot The first row on the array is set to 1, that is, the LED anode is high level, and the remaining rows are 0, that is, low level
}
}
Previous article:51 microcontroller learning: LED dot matrix experiment (display numbers)
Next article:51 microcontroller learning: IO expansion (serial to parallel) experiment-74HC595
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Beginner's guide to electronics
- Will UWB positioning be as accurate as Beidou?
- Brief Introduction of Non-Magnetic Coil Solution for National Technology Intelligent Water Meter
- Ask for help from the moderator
- Are there any 6-channel analog switches that you would recommend?
- mini risc mcu source code
- SIGMATEL's D-MAJOR MP3 Flash Driver Application Note
- What is a Current Transformer? How to Design a Current Transformer?
- Why are the edges of the lines always uneven when connecting manually?
- What are the conditions for program interruption in the figure?