Microcontroller learning - LED display program one

Publisher:HarmonySpiritLatest update time:2016-01-20 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Title: Scroll and display 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f on an eight-digit LED display.

         And the cycle continues.

Solution: (C language programming)
#include       
#include
#define uint unsigned int
#define uchar unsigned char

uchar sled_bit_table[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};

 uchar sled_disp_buff[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,

0x83,0xc6,0xa1,0x86,0x8e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};           

#define sled_dm_port  P0      
#define sled_wm_port  P2    

sbit speaker_en_port = P3^7; 
void delay_1ms(uchar x)
{
   uchar j;
   while(x--){
       for(j=0;j<125;j++)
           {;}
        
}
void main()
{
 uchar i;
 uchar j;
 uint count=0;

 speaker_en_port = 0;
 while(1){
  for(j=0;j<100;j++){ 
   for(i=0;i<8;i++){ 
    sled_wm_port = 0xff; 

    sled_dm_port = sled_disp_buff[i+count]; 
    sled_wm_port = sled_bit_table[i]; 

    delay_1ms(1);
    }
   }
  count++;
  if(count>=24) count=0; 

  
}

Keywords:MCU Reference address:Microcontroller learning - LED display program one

Previous article:Single chip microcomputer learning - LED display experiment 2
Next article:Microcontroller Learning - Independent Button 4

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

LED spotlight intelligent drive and power supply circuit design
  Monitoring lighting is the mainstream of energy saving in the world, and high-power LED lighting is the mainstream trend of lighting systems in the future. High-power LED has the characteristics of high brightness, energy saving, environmental protection, safety and high stability, saving 60% to 70% of electricity c
[Power Management]
LED spotlight intelligent drive and power supply circuit design
Design of Communication Adapter Card Based on PIC Microcontroller
CAN bus - Controller Area Network (CAN) international standard (ISO11898). Compared with general communication buses, CAN bus has outstanding reliability, real-time and flexibility in data communication. Its characteristics can be summarized as follows: CAN works in a multi-master mode. Based on the message ide
[Microcontroller]
Design of Communication Adapter Card Based on PIC Microcontroller
HC SemiTek brings BOE, Sharp, and Innolux into the Mini LED team
On September 26, HC Semitek signed a strategic cooperation agreement with BOE and other companies in Shenzhen to jointly develop Mini LED. In addition, companies that have signed strategic cooperation agreements on micro-display with HC Semitek also include display panel companies such as Sharp and Innolux, as well as
[Mobile phone portable]
Measurement of junction temperature of LED light strip bulbs
The LED light bar can achieve 360-degree light source without adding lens, which makes people feel like returning to the traditional incandescent lamp.    LED light bar has many application advantages, which has created a big whirlwind in the market and is being quickly accepted by users. LED light bar combines the tr
[Power Management]
Measurement of junction temperature of LED light strip bulbs
51 Which microcontroller is better for getting started with microcontroller programming?
In fact, every man has a dream of "Iron Man" in his heart. I hope I have the same skills as the male protagonist and can change the world through technology. However, if you want to achieve this step, you need to learn so many things that you may not be able to finish them in your lifetime. It’s this kind of out-of-re
[Microcontroller]
Focusing on the IoT field, Hongbo Micro promotes the process of domestic substitution with the "MCU+" strategy
In recent years, due to the rapid development of the Internet of Things, the increase in the number of networked nodes, the increased penetration of automotive electronics, and the strong demand for automation equipment in Industry 4.0, the use of MCUs in downstream application fields such as automotive electronics, t
[Mobile phone portable]
Basic hardware circuit design of STM8 microcontroller
  In fact, STM8 does not need a crystal oscillator and reset circuit, but in order to ensure the stable operation of the minimum system, it is best to add an external circuit. ● STM8 reset circuit design   The STM8 microcontroller has a built-in power-on reset (POR), so the STM8 microcontroller can be reset normally
[Microcontroller]
Basic hardware circuit design of STM8 microcontroller
Design and implementation of digital controlled DC current source based on Sunplus microcontroller
DC current sources with good stability, high precision and preset output are often used in electronic devices. The digitally controlled DC current source designed in this paper can effectively reduce the output error caused by aging of components, temperature drift and other reasons. The output current is adjustable
[Power Management]
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号