标题:在八位LED显现器上翻滚显现0、1、2、3、4、5、6、7、8、9、a、b、c、d、e、f,
且循环下去。
解决方案:(C言语编程)
#include
#include
#define uint unsigned int
#define uchar unsigned char
uchar sled_bit_table[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar sled_disp_buff[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,
0x83,0xc6,0xa1,0x86,0x8e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
#define sled_dm_port P0
#define sled_wm_port P2
sbit speaker_en_port = P3^7;
void delay_1ms(uchar x)
{
uchar j;
while(x–){
for(j=0;j<125;j++)
{;}
}
}
void main()
{
uchar i;
uchar j;
uint count=0;
speaker_en_port = 0;
while(1){
for(j=0;j<100;j++){
for(i=0;i<8;i++){
sled_wm_port = 0xff;
sled_dm_port = sled_disp_buff[i+count];
sled_wm_port = sled_bit_table[i];
delay_1ms(1);
}
}
count++;
if(count>=24) count=0;
}
}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ziliao/beidong/260993.html