⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 pic 实例源程序 有需要的兄弟久拿走啊 别客气 哈哈 我会继续努力的
💻 C
字号:
#include <REG52.H>                /* special function register declarations   */
                                  /* for the intended 8051 derivative         */

#include <stdio.h>                /* prototype declarations for I/O functions */

#ifdef MONITOR51                         /* Debugging with Monitor-51 needs   */
char code reserve [3] _at_ 0x23;         /* space for serial interrupt if     */
#endif                                   /* Stop Exection with Serial Intr.   */
                                         /* is enabled                        */
/*------------------------------------------------
The main C function.  Program execution starts
here after stack initialization.
------------------------------------------------*/

#define ON  1
#define OFF 0

sbit Lamp1=P0^0;
sbit Lamp2=P0^1;
sbit Lamp3=P0^0;
sbit Lamp4=P0^1;
sbit Lamp5=P0^0;
sbit Lamp6=P0^1;
sbit Lamp7=P0^0;
sbit Lamp8=P0^1;


void initial();
void delay();

main()
{
    initial();
    delay();
    while(1)
    {
        Lamp1=ON;
        delay();
        Lamp1=OFF;
        delay();
        
        Lamp2=ON;
        delay();
        Lamp2=OFF;
        delay();
        
        Lamp3=ON;
        delay();
        Lamp3=OFF;
        delay();
        
        Lamp4=ON;
        delay();
        Lamp4=OFF;
        delay();
        
        Lamp5=ON;
        delay();
        Lamp5=OFF;
        delay();
        
        Lamp6=ON;
        delay();
        Lamp6=OFF;
        delay();
        
        Lamp7=ON;
        delay();
        Lamp7=OFF;
        delay();
        
        Lamp8=ON;
        delay();
        Lamp8=OFF;
        delay();
        
    }
}

void initial()
{
    Lamp1=OFF;
    Lamp2=OFF;
    Lamp3=OFF;
    Lamp4=OFF;
    Lamp5=OFF;
    Lamp6=OFF;
    Lamp7=OFF;
    Lamp8=OFF;
}

void delay()
{
    int i=0;
    while(i<10000)i++;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -