標題:
今天的單片機流水燈作業(yè),很有成就感
[打印本頁]
作者:
mazeqin
時間:
2017-11-22 16:32
標題:
今天的單片機流水燈作業(yè),很有成就感
嘻嘻嘻
0.png
(16.15 KB, 下載次數(shù): 42)
下載附件
2017-11-23 02:13 上傳
0.png
(12.19 KB, 下載次數(shù): 29)
下載附件
2017-11-23 02:13 上傳
單片機源程序如下:
//3-7-7:使用數(shù)組的指針控制P2口流水燈
#include<reg52.h> //包含單片機寄存器定義的頭文件
/*************************
延時函數(shù)
*************************/
void delay(void)
{
unsigned char m,n;
for(m=0;m<250;m++)
for(n=0;n<250;n++)
;
}
/*****}*********************
主函數(shù)
**************************/
void main(void)
{
unsigned char i;
unsigned char Tab[]={
0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,//單燈左移
0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,//單燈右移
0xff,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,//雙燈開合
0x00,0x81,0xc3,0xe7,0xff,0xe7,0xc3,0x81,0x00};//全燈收放
//流水燈控制碼數(shù)組
unsigned char *p; //定義無符號字符型指針
p=Tab; //將數(shù)組首地址存入指針p
while(1) //無限循環(huán)
{
for(i=0;i<34;i++) //共34個流水燈控制碼
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
流水燈.rar
(41.39 KB, 下載次數(shù): 4)
2017-11-22 16:30 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1