微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > pic单片机8位点阵的字母滚动

pic单片机8位点阵的字母滚动

时间:11-29 来源:互联网 点击:
因为程序内存的原因不能用2维数组,所以只好定义8个数组来显示字母,也就只有8个字母可以显示了,听何家伟说往数组前面加一个code就可以定义了,不过不知道PIC里面能不能用,先把还不算太完善的作品贴出来再慢慢改吧。本来想把视频传上来还要黄钻,晕。算了。
#include void delay();void init();unsigned char table[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};unsigned char  scan[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};unsigned char  A[8]={0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44};//Aunsigned char  B[8]={0x00,0x3C,0x44,0x44,0x3C,0x44,0x44,0x3C};//Bunsigned char  C[8]={0x00,0x78,0x04,0x04,0x04,0x04,0x04,0x78};//Cunsigned char  D[8]={0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C};//Dunsigned char  E[8]={0x00,0x7C,0x04,0x04,0x7C,0x04,0x04,0x7C};//Eunsigned char  F[8]={0x00,0x7C,0x04,0x04,0x7C,0x04,0x04,0x04};//Funsigned char  G[8]={0x00,0x38,0x44,0x04,0x04,0x74,0x44,0x38};//Gunsigned char  H[8]={0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44};//Hunsigned char i,j,k,temp,m,x,y,z,n;main(){TRISC=0X00;TRISB=0X00;while(1){init();while(k){for(m=0;m<8;m++){table=A200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=A>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=B200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=B>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=C200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=C>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=D200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=D>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=E200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=E>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=F200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=F>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=G200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=G>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}init();while(k){for(m=0;m<8;m++){table=H200)temp==1;k--;}if(!k){for(x=0;x<8;x++){for(m=0;m<8;m++){table=H>>x;}for(temp=1;temp<=200;temp++){for(i=0;i<8;i++){PORTB=~table[i];PORTC=scan[i];delay();PORTC=0X00;}}if(temp>200)temp==1;}}}}void init(){k=5;x=0;}void delay(){for(j=1;j<100;j++);}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top