Single chip microcomputer running water lamp experimental program

Publisher:玉树琼花Latest update time:2015-06-29 Source: 51heiKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The running light is a program that many beginners learn. It can be said that it is a must-learn program. To give a simple example of its application, many production lines require left and right shift operations. Perhaps the running light program is the simplest and can be called a classic example.

Program: #include
#include
#define uni unsigned int
#define unc unsigned char
void delay(int);
unc tems;
void main()
{
 tems = 0xfe;
 P1 = tems;//Assign value to P1 port
 while(1)
 {
  tems = _cror_(tems,1);//Shift operation?
  delay(300);
  P1 = tems;
    }
}
void delay(int z)//Delay subroutine
{
 uni x,y;
 for(x=z;x>0;x--)
  for(y=500;y>0;y--);
}

Keywords:MCU Reference address:Single chip microcomputer running water lamp experimental program

Previous article:Shiny Program for MCU
Next article:51, Comparison of PIC and AVR microcontrollers

Latest Microcontroller Articles
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号