STC89C52RC單片機8位流水燈程序
2022-02-21 18:20:06|
來源:網(wǎng)絡(luò) 作者:
#include//頭文件/***********宏定義*******************/#define uint unsigned int#define uchar unsigned char/*********數(shù)組定義并賦值************/uchar LED[]={0XFE,0XFD,0XFB,0XF7,0XEF,0XDF,0XBF,0X7F};/**********延時子程序***************/void delayms(uint xms){ uint i,j; for(i=xms;i>0;i--) for(j=124;j>0;j--);}/*************主程序*************/void main(){ uchar n; while(1) { for(n=0;n<8;n++) { P0=LED[n]; //將數(shù)據(jù)傳給P0口 delayms(500); //延時500MS } }}
標簽: