LED running light Dynamic Digital Tube 52 single chip microcomputer

Source: Internet
Author: User

#include "reg52.h" #include <intrins.h>void delay (int i) {while (i--);} void Main () {char i;led=0xfe;delay (50000), while (1) {i=0;i<7;i++) {P2=_crol_ (p2,1);d Elay (50000);} for (i=0;i<7;i++) {p2=_crled_ (p2,1);d Elay (50000);}}

  

1#include"reg52.h"             2Sbit lsa=p2^2;3Sbit lsb=p2^3;4Sbit lsc=p2^4;5U8 Code smgduan[ -]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,6                     0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};//displays the value of the 0~f7 voidDelayinti)8 {9      while(i--); Ten } One voidDigdisplay () A { -     Chari; -      for(i=0;i<8; i++) the     { -         Switch(i)//selection, select the light-lit digital tube, -         { -              Case(0): +Lsa=0; lsb=0; Lsc=0; Break;//Show No. 0 bit -              Case(1): +Lsa=1; lsb=0; Lsc=0; Break;//Show 1th bit A              Case(2): atLsa=0; lsb=1; Lsc=0; Break;//Show 2nd Bit -              Case(3): -Lsa=1; lsb=1; Lsc=0; Break;//Show 3rd Bit -              Case(4): -Lsa=0; lsb=0; Lsc=1; Break;//Show 4th Bit -              Case(5): inLsa=1; lsb=0; Lsc=1; Break;//Show 5th Bit -              Case(6): toLsa=0; lsb=1; Lsc=1; Break;//Show 6th Bit +              Case(7): -Lsa=1; lsb=1; Lsc=1; Break;//Show 7th Bit the         } *P0=smgduan[i];//Send segment Code $Delay -);//interval Time ScanPanax Notoginsengp0=0x00;//blanking -     } the } +  A voidMain () the {     +      while(1) -     {     $Digdisplay ();//Digital Tube Display function $     }         -}

LED running light Dynamic Digital Tube 52 single chip microcomputer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.