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

📄 thefirstexampleok.c

📁 单片机中实现跑马灯程序
💻 C
字号:
/**********************************************
*   File: TheFirstExampleOK.c
*   Description: The first delay example
*   Created Date:  2007-09-04
*   Last Modified: 2007-09-04
*   Author: Jeffrey - Schicksal@126.com
*   Notes: None
**********************************************/

#include <REGX51.h>
#define LED_FLASH_T 10000;

/**********************************************
*   Function: delay(unsigned int t)
*   Input Variables: t
*   Return Variables: None
*   Usage: Common Delay Routine, t as the delay time ticks
**********************************************/
void delay(unsigned int t)
{
		for(;t>0;t--);		// 延时循环
}

/**********************************************
*   Function: main()
*    Input Variables: None
*   Return Variables: None
*   Usage: Program Entry
**********************************************/
void main()
{
		while(1)
		{
				P0 = 0x00;		// P0口输出电平低
				delay(LED_FLASH_T);
				P0 = 0xff;		// P0口输出电平高
				delay(LED_FLASH_T);
		}
}

⌨️ 快捷键说明

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