要求
1、动态显示字符串"Hello!"
效果
资源
工程文件压缩包
链接:https://pan.baidu.com/s/1FP58oMx6heVpkk-mGlEtRg
提取码:yj22
main函数
#include <REGX52.H>
#include "Delay.H"
#include "MATRIXLED.H"
void main(){
//加上code(加上之后不可更改内容),表示将数据放在flash中(空间更大,不容易溢出)
unsigned char code context[]={0,0,0,0,0,0,0,3,12,56,216,27,28,48,192,16,60,86,147,147,83,51,0,1,15,49,193,1,1,0,0,1,15,49,193,1,1,0,60,66,129,129,129,129,66,60,0,0,0,251,251,0,0,0,0,0,0,0};
unsigned char i;
unsigned char counter=0;
unsigned char base=0;
_74HC595_Init();
//共58列,显示字符串"HELLO !"
while(1){
for(i=0;i<8;i++){
MatrixLED_ShowColumn(i,context[base+i]);
}
counter++;
if(counter>14){ //每一帧动画显示次数
counter=0;
base++; //显示下一帧动画
if(base>50){ //一共显示多少帧动画
base=0;
}
}
// for(i=0;i<44;i++){
// MatrixLED_ShowColumn(0,context[i]);
// MatrixLED_ShowColumn(1,context[i+1]);
// MatrixLED_ShowColumn(2,context[i+2]);
// MatrixLED_ShowColumn(3,context[i+3]);
// MatrixLED_ShowColumn(4,context[i+4]);
// MatrixLED_ShowColumn(5,context[i+5]);
// MatrixLED_ShowColumn(6,context[i+6]);
// MatrixLED_ShowColumn(7,context[i+7]);
// Delayms(300);
// }
}
}