今天看了下点阵的教程,自己跑去搞了下 ,结果弄是弄出来,可就是每次图像移动前都会红一团
这是电路图还有代码,大大帮忙看看
#include<reg52.h>#define uchar unsigned char#define uint unsigned intsbit dula=P2^6;sbit wela=P2^7;sbit diola=P2^5;uint num,flag,num1;uchar code table[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x81,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0x81,0xff,0x99,0x00,0x00,0x00,0x81,0xc3,0xe7,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0xC3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,};uchar code table1[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};void delay(uchar x){
uchar a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);}void main(){
dula=1;
wela=1;
P0=0xff;
dula=0;
wela=0;
while(1)
{
for(num=0;num<8;num++)
{
dula=1;
P0=table[num+flag];
dula=0;
P0=0;
diola=1;
P0=table1[num];
diola=0;
delay(5);
P0=0xff;
} flag++;
if(flag==40)
flag=0;
delay(200);
}}
此帖出自
小平头技术问答
一周热门 更多>