电路图如下:
8*8共阳点阵,行阳列阴,行用74ls164,列用74hc154
单片机程序如下:
#include <reg52.h>
#include <intrins.h>
sbit ADDR0 = P2^0;
sbit ADDR1 = P2^1;
sbit ADDR2 = P2^2;
sbit ADDR3 = P2^3;
sbit COW_1641 = P0^0;
sbit COW_1642 = P0^2;
sbit CLK_1641 = P0^1;
sbit CLK_1642 = P0^3;
sbit TEST = P0^7;
unsigned char colcount[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
unsigned char code image[8] = {0x00,0x00,0x7E,0x48,0x48,0x48,0x00,0x00}; //字母 F ,纵向取模,反选
void delay(unsigned int delay){
unsigned char i;
for(;delay>0;delay--)
for(i=0;i<110;i++);
}
void main(){
unsigned int col,coldata,speed;
unsigned char temp;
while ( 1 ) {
P2=0xff;
for (col=0;col<8;col++){
P2=col;
temp=image[col];
for(coldata=0;coldata<8;coldata++){
CLK_1641 = 0;
COW_1641=(temp)&0x80;
CLK_1641 = 1;
temp<<=1;
}
CLK_1641 = 0;
CLK_1641 = 1;
delay(20);
}
}
}
我的问题如下:
1、电路这样设计是否可以,主要是考虑154直接接点阵是否会烧?
2、现在点阵显示的“F”是上下翻转后又镜像,这个问题是代码哪里错了?
谢谢!
|