欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
8051單片機控制8*8點陣時,不用譯碼器可以嗎?
[打印本頁]
作者:
深海皮皮蝦仁
時間:
2019-5-24 11:31
標題:
8051單片機控制8*8點陣時,不用譯碼器可以嗎?
8051單片機控制8*8點陣時,不用譯碼器可以嗎?8*8總共燈的數量大于51單片機接口數量,但是又不會用譯碼器,有沒有不用譯碼器實現控制的方法啊,比如顯示特定兩位數字之類的。
作者:
Angle丶陽
時間:
2019-7-18 10:06
protuse可以做到的 8*8點陣陽極接P2口,陰極接P1口,用下面的代碼就可以實現!
#define uchar unsigned char
void Init_int();
void Init_time();
void display(int yin,int yang);
uchar num_num[10][5]={{0xf0,0xf6,0xf6,0xf6,0xf0}, //0
{0xf7,0xf7,0xf7,0xf7,0xf7}, //1
{0xf0,0xfe,0xf0,0xf7,0xf0}, //2
{0xf0,0xfe,0xf0,0xfe,0xf0}, //3
{0xf6,0xf6,0xf0,0xfe,0xfe}, //4
{0xf0,0xf7,0xf0,0xfe,0xf0}, //5
{0xf0,0xf7,0xf0,0xf6,0xf0}, //6
{0xf0,0xfe,0xfe,0xfe,0xfe}, //7
{0xf0,0xf6,0xf0,0xf6,0xf0}, //8
{0xf0,0xf6,0xf0,0xfe,0xf0}}; //9
uchar num_zero[5]={0xf0,0xf6,0xf6,0xf6,0xf0};
uchar num_one[5]={0xfe,0xfe,0xfe,0xfe,0xfe};
uchar num_two[5]={0xf0,0xfe,0xf0,0xf7,0xf0};
uchar num_three[5]={0xf0,0xfe,0xf0,0xfe,0xf0};
uchar num_fore[5]={0xf6,0xf6,0xf0,0xfe,0xfe};
uchar num_five[5]={0xf0,0xf7,0xf0,0xfe,0xf0};
uchar num_six[5]={0xf0,0xf7,0xf0,0xf6,0xf0};
uchar num_seven[5]={0xf0,0xfe,0xfe,0xfe,0xfe};
uchar num_eight[5]={0xf0,0xf6,0xf0,0xf6,0xf0};
uchar num_nine[5]={0xf0,0xf6,0xf0,0xfe,0xf0};
unsigned int count,i=1,weiyi,timer,shu,n=1;
void main()
{
Init_time();
Init_int();
while(1)
{}
}
void Init_time() //定時器初始化
{
TMOD|=0x01;
TH0=0xff;
TL0=0x10;
TR0=1;
ET0=1;
EA=1;
}
void Init_int() //中斷初始化
{
EA=1;
EX0=1;
ET0=1;
}
void time() interrupt 1 //定時器函數
{
TH0=0xfd; //50微秒
TL0=0xa8;
count++;
if(count>8)
{
count=0;
display(i-1,i);
i++;
if(i>5)
i=1;
}
timer++;
if(timer>250)
{
timer=0;
weiyi++;
if(weiyi>10)
{
weiyi=0;
shu++;
if(shu>9)
shu=0;
}
}
}
void display(int yin,int yang) //顯示函數
{
P2 = 0x00;
P1 = ~(~num_num[shu][yin]<<weiyi);
if(weiyi<3)
{
P1 = ~(~num_num[shu][yin]>>3-weiyi);
}
else
{
P1 = ~(~num_num[shu][yin]<<weiyi-3);
}
switch(yang)
{
case 0 : P2 = 0x01;break;
case 1 : P2 = 0x02;break;
case 2 : P2 = 0x04;break;
case 3 : P2 = 0x08;break;
case 4 : P2 = 0x10;break;
case 5 : P2 = 0x20;break;
case 6 : P2 = 0x40;break;
case 7 : P2 = 0x80;break;
default : P2 = 0x00; break;
}
}
作者:
bxyyhan
時間:
2020-2-5 09:11
只要單片機有16個口就行,陽極接一組,比如P2口,陰極接一組,比如P0。
作者:
wxl2020
時間:
2020-2-6 11:12
可以,我之前就做過
作者:
banalsheep
時間:
2020-2-6 12:58
矩陣(并行,不用譯碼)接法,8+8個IO可行
作者:
hantu
時間:
2020-2-6 13:55
可以,不用譯碼器(74HC138等)還可以用其它鎖存器的嘛,比如74HC595、74HC573等等,也可以直接單片機引腳加三級管直接驅動都行。
但是,如果你是用現成的板,那么它用了什么東西你就得用它的呀。
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1