標題:
8×8LED點陣屏仿電梯數(shù)字滾動顯示單片機C程序
[打印本頁]
作者:
q1249969321
時間:
2018-12-24 11:00
標題:
8×8LED點陣屏仿電梯數(shù)字滾動顯示單片機C程序
#include<reg52.h>
#include<absacc.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
/*-------------------------------------------------------
功能:5*7點陣表
----------------------------------------------------------*/
uchar code biao[11][8]=
{
{0x70,0x88,0x98,0xA8,0xC8,0x88,0x70,0x00}, // -0-
{0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00}, // -1-
{0x70,0x88,0x08,0x30,0x40,0x80,0xF8,0x00}, // -2-
{0xF8,0x08,0x10,0x30,0x08,0x88,0x70,0x00}, // -3-
{0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x00}, // -4-
{0xF8,0x80,0xF0,0x08,0x08,0x88,0x70,0x00}, // -5-
{0x38,0x40,0x80,0xF0,0x88,0x88,0x70,0x00}, // -6-
{0xF8,0x08,0x10,0x20,0x40,0x40,0x40,0x00}, // -7-
{0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00}, // -8-
{0x70,0x88,0x88,0x78,0x08,0x10,0xE0,0x00}, // -9-
{0x20,0x70,0xa8,0x20,0x20,0x20,0x20,0x00} // -↑-
};
/*-------------------------------------------------------
功能:掃描表
----------------------------------------------------------*/
//uchar code sao[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar code sao[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
/*-------------------------------------------------------
功能:串口初始化,波特率9600 方式0 8 UART
-------------------------------------------------------*/
void Init_Com(void)
{
SCON = 0x00; //方式0
}
/*-------------------------------------------------------
功能:延時
-------------------------------------------------------*/
//1
void DELAY_25mS(void)
{
unsigned int x = 45438;
while (--x)
{
_nop_();
}
}
//2
delay(uchar ms)
{ // 延時子程序
uchar i;
while(ms--)
{
for(i = 0; i<250; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}
//3
delay1(t)
{
while(t--)
{
;
}
}
/*-------------------------------------------------------
功能:顯示子程序
-------------------------------------------------------*/
xian()
{
uchar a;
for(a=0;a<8;a++)
{
SBUF =biao[0][a]; //串口發(fā)第一個顯示字
while(!TI);
TI=0;
SBUF =biao[1][a]; //串口發(fā)第二個顯示字
while(!TI);
TI=0;
SBUF =biao[3][a]; //串口發(fā)第三個顯示字
while(!TI);
TI=0;
P1=sao[a]; //
delay1(100);
P1=0xff;
}
}
/*-------------------------------------------------------
主程序
功能:實現(xiàn)接收數(shù)據(jù)并把接收到的數(shù)據(jù)發(fā)送出去
-------------------------------------------------------*/
void main()
{
uchar ii;
Init_Com();
//SBUF = dis_7[0]; //發(fā)送數(shù)據(jù)
//while(!TI);
//TI=0;
while(1)
{
xian();
}
}
作者:
admin
時間:
2018-12-24 16:25
補全原理圖或者詳細說明一下電路連接即可獲得100+黑幣
作者:
ssk7793
時間:
2018-12-24 16:44
代碼中沒看到io口定義,一堆頭文件,樓主卻沒有上傳附件
作者:
aoppol
時間:
2020-10-16 21:29
亂寫一通
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1