51 microcontroller learning: LED dot matrix experiment (display image)

Publisher:恬淡岁月Latest update time:2023-02-06 Source: zhihu Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Experiment name: LED dot matrix experiment (display image)
Wiring instructions:
Experimental phenomenon: After downloading the program, the 8*8 LED dot matrix displays a heart shape.
Note: The J24 yellow jumper cap next to the LED dot matrix is ​​shorted 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

u8 gled_row[8]={0x38,0x7C,0x7E,0x3F,0x3F,0x7E,0x7C,0x38};//LED dot matrix display image row data
u8 gled_col[8]={0x7f,0xbf,0xdf,0xef,0xf7 ,0xfb,0xfd,0xfe};//Column data of LED dot matrix display image

/****************************************************** ****************************
* 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;

while(1)
{
for(i=0;i<8;i++)//Loop 8 times to scan 8 rows and columns
{
LEDDZ_COL_PORT=gled_col[i];//Transmit column selection data
hc595_write_data(gled_row[i]);/ /Transmit row selection data
delay_10us(100);//Delay for a period of time, waiting for the display to stabilize
hc595_write_data(0x00);//Eliminate shadow
}
}
}



Reference address:51 microcontroller learning: LED dot matrix experiment (display image)

Previous article:51 Microcontroller Learning: DC Motor Experiment
Next article:51 microcontroller learning: LED dot matrix experiment (display numbers)

Recommended ReadingLatest update time:2024-11-16 13:47

A review of the advantages of LED fluorescent lamps
LED fluorescent lamps are increasingly entering people's lives due to their unique advantages. What are the advantages of this kind of lamp? Let's take stock today. First of all, LED fluorescent lamps do not use mercury and do not contain lead. Traditional fluorescent lamps contain a large amount of mercury vap
[Power Management]
LED indoor lighting should focus on CRI, light distribution and light pollution
The "Future Trends of Indoor Lighting" special summit of the 2012 Shanghai International New Light Source & New Energy Lighting Forum was held at the Shanghai World Expo Exhibition and Convention Center. At the meeting, Professor Xiao Hongqing of the Taiwan University of Science and Technology gave a spee
[Power Management]
PCB Design Technology for LED Switching Power Supply
The physical design of the PCB board is the last step in the design of switching power supplies. If the design method is not appropriate, the PCB may radiate too much electromagnetic interference, causing unstable power supply operation. The following is an analysis of the matters that need to be paid attention to i
[Power Management]
LED lighting technology could allow interstellar travelers to grow their own food
Future interstellar travelers may be able to grow food in space and achieve self-sufficiency. According to foreign media reports, Mike Dixon from the University of Guelph is leading a research team to develop an LED technology that will allow astronauts to grow food in space at the most efficient rate. If we wan
[Power Management]
LED lighting technology could allow interstellar travelers to grow their own food
iWatt LED Lighting Power Supply Development Challenges
The five major market demand trends for LED lighting driver power supplies can be summarized as: high efficiency, high reliability, wide compatibility with dimming and non-dimming applications, smaller and smaller size, and no optocoupler. To meet the increasingly high requirements of the application market for LED
[Power Management]
iWatt LED Lighting Power Supply Development Challenges
Discussion on high quality LED manufacturing
Only a small number of LED manufacturers can produce high-quality LEDs . For applications that are only used for simple indication, low-quality LEDs are sufficient. However, high-quality LEDs must be used in many fields that require consistency, reliability, solid-state indication or lighting, especially
[Power Management]
Discussion on high quality LED manufacturing
S3C2440 Linux driver transplantation——LED heartbeat
Development board: TQ2440 Kernel: Linux 2.6.32 PC OS:Ubuntu 11.04     This article will explain the transplantation of LED drivers. The LED in this article is used to realize heartbeat, that is, after the system is started, the LED will flash at a fixed frequency like a human heart. Unless the system freezes, the LE
[Microcontroller]
S3C2440 Linux driver transplantation——LED heartbeat
Powerint LNK454DG RDR268 ultra-small LED driver solution
Powerint's RD-268 is a 1.1W PFC LED driver (non-isolated) reference design using the LinkSwitchTM-PL series LNK454DG. It has a single constant current output of 366mA, an LED voltage of 3.0V, a universal 85 VAC to 265 VAC, 47 Hz to 63 Hz input, a power factor greater than 0.85, a THD less than 25%, and a very small siz
[Power Management]
Powerint LNK454DG RDR268 ultra-small LED driver solution
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号