找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 4034|回復(fù): 3
收起左側(cè)

8×8LED點(diǎn)陣屏仿電梯數(shù)字滾動(dòng)顯示單片機(jī)C程序

[復(fù)制鏈接]
ID:234873 發(fā)表于 2018-12-24 11:00 | 顯示全部樓層 |閱讀模式
#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點(diǎn)陣表
----------------------------------------------------------*/
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  

}
/*-------------------------------------------------------
功能:延時(shí)
-------------------------------------------------------*/
//1
void DELAY_25mS(void)
{
   unsigned int x = 45438;
   while (--x)
   {
      _nop_();
   }
}
//2
delay(uchar ms)
{       // 延時(shí)子程序
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ā)第一個(gè)顯示字
while(!TI);
     TI=0;
     SBUF =biao[1][a]; //串口發(fā)第二個(gè)顯示字
while(!TI);
     TI=0;
     SBUF =biao[3][a]; //串口發(fā)第三個(gè)顯示字
while(!TI);
     TI=0;
     P1=sao[a]; //
        delay1(100);
        P1=0xff;
       }
}
/*-------------------------------------------------------
主程序
功能:實(shí)現(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();
   }
}
回復(fù)

使用道具 舉報(bào)

ID:1 發(fā)表于 2018-12-24 16:25 | 顯示全部樓層
補(bǔ)全原理圖或者詳細(xì)說明一下電路連接即可獲得100+黑幣
回復(fù)

使用道具 舉報(bào)

ID:424598 發(fā)表于 2018-12-24 16:44 | 顯示全部樓層
代碼中沒看到io口定義,一堆頭文件,樓主卻沒有上傳附件
回復(fù)

使用道具 舉報(bào)

ID:383832 發(fā)表于 2020-10-16 21:29 | 顯示全部樓層
亂寫一通
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表