标题: 闲来无事随意写回复8*8点阵显示箭头 单片机程序 [打印本页]

作者: xianfajushi    时间: 2022-12-1 13:58
标题: 闲来无事随意写回复8*8点阵显示箭头 单片机程序
缘由http://www.51hei.com/bbs/dpj-225369-1.html

#include<reg52.h>
unsigned char code M[]={
        0xff,0xff,0xfe,0xfd,0xf8,0xfd,0xfe,0xff,
  0xff,0xff,0xfd,0xfb,0xf0,0xfb,0xfd,0xff,
  0xff,0xff,0xfb,0xf7,0xe0,0xf7,0xfb,0xff,
  0xff,0xff,0xf7,0xef,0xc0,0xef,0xf7,0xff,
  0xff,0xff,0xef,0xdf,0x80,0xdf,0xef,0xff,
  0xff,0xff,0xdf,0xbf,0x00,0xbf,0xdf,0xff};

void main()
{
        unsigned char wei=0,zt=1,ys=0,cs=0,sj=0;
        while(1)
        {

                if(wei==0)wei=1;else wei*=2;
                P3=M[sj+cs];
                P2=wei;
                while(++ys);
                P2=P3=255;
                if(++sj>8){sj=0;++zt;}
                if(zt>47){cs+=8;if(cs>40)cs=0;zt=0;}
        }
}






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1