標題:
8*8點陣和數(shù)碼管顯示proteus仿真原理圖與單片機代碼
[打印本頁]
作者:
克蘇魯
時間:
2017-4-29 13:11
標題:
8*8點陣和數(shù)碼管顯示proteus仿真原理圖與單片機代碼
8*8點陣proteus仿真與數(shù)碼管原理圖如下:
0.png
(15.19 KB, 下載次數(shù): 90)
下載附件
2017-4-29 18:01 上傳
0.png
(60.94 KB, 下載次數(shù): 82)
下載附件
2017-4-29 18:01 上傳
單片機源程序:
#include <reg52.h>
//此表為 LED 的字模, 共陰數(shù)碼管 0-9 -
unsigned char code Disp_Tab[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40}; //段碼控制
//此表為8個數(shù)碼管位選控制, 共陰數(shù)碼管 1-8個 -
unsigned char code dispbit[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdF,0xbF,0x7F}; //位選控制 查表的方法控制
unsigned char led_buffer0[8]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};
unsigned char code led_buffer[]={
/*-- 調(diào)入了一幅圖像:C:\Users\Administrator\Pictures\numb.bmp --*/
/*-- 寬度x高度=80x8 --*/
0x00,0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,
0x00,0x00,0x00,0x42,0x7F,0x40,0x00,0x00,
0x00,0x00,0x62,0x51,0x49,0x45,0x42,0x00,
0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00,
0x00,0x00,0x18,0x14,0x12,0x7F,0x10,0x00,
0x00,0x00,0x2F,0x49,0x49,0x49,0x31,0x00,
0x00,0x00,0x3E,0x49,0x49,0x49,0x32,0x00,
0x00,0x00,0x01,0x01,0x79,0x05,0x03,0x00,
0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00,
0x00,0x00,0x26,0x49,0x49,0x49,0x3E,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
unsigned char disp_count=0,numb=0;
unsigned char hour=23,min=45,sec=58;
unsigned int count=0;
bit flash=0;
void delay(long dly)
{
while(dly--);
}
void main()
{
unsigned char i;
TMOD=0X01;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
TR0=1;
ET0=1;
EA=1;
while(1)
{
// get_clock();
delay(3000);
numb++;
if(numb>79)
{
numb=0;
}
}
}
void TIMER0_ISR(void) interrupt 1
{
P2=0x00;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
P0=~led_buffer[numb+disp_count];
P3=~led_buffer[numb+8+disp_count];
P2=~dispbit[disp_count];
disp_count++;
if(disp_count>7)
{
disp_count=0;
}
count++;
if(count>249)
{
count=0;
flash=!flash;
}
}
復(fù)制代碼
下載:
8X8點陣.rar
(54.61 KB, 下載次數(shù): 45)
2017-4-29 13:11 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1