Welcome![Sign In][Sign Up]
Location:
Downloads SourceCode Embeded-SCM Develop SCM
Title: Text4 Download
 Description: #include <reg51.h> #define LED P1 //宏定义,使用LED代替P1口(相当于LED=P1) #define uchar unsigned char //用uchar代替unsigned char方便操作 #define uint unsigned int /*------------------time ms延时函数-----------------*/ void delay_ms(uint time) { uchar tres for( time>0 time--) { tres=150 while(tres--) } } void main() { uchar t LED=0X01 //P1=00000001B while(1)//死循环,不停的点亮和熄灭LED { for(t=0 t<8 t++) { LED=~LED //按位取反,点亮一个LED delay_ms(100) //延时0.1s LED=~LED //按位取反 LED<<=1 //左移一位,点亮不同的LED } LED=0X80 //P1=10000000B for(t=0 t<8 t++) { LED=~LED //按位取反,点亮一个LED delay_ms(100) //延时0.1s LED=~LED //按位取反 LED>>=1 //右移一位,点亮不同的LED } LED=0X01 //P1=00000001B } }
 Downloaders recently: [More information of uploader mayuehhh]
 To Search:
File list (Check if you may need any files):
Text4.c
    

CodeBus www.codebus.net