/************************************************** *******/
#include<REG52.h>
#include<string.h>
#include<stdio.h>
#include<font.c>
int j,k;
unsigned char x,i;
unsigned char string[]="DH CONG NGHIEP HA NOI ";
unsigned char idata font[200];
unsigned char ma[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
int d=0;
/***********Ham xu ly ki tu***********/
void xuly()
{
unsigned int i,j,l;
l=strlen(string);// l la do dai cua xau ki tu
for(i=0;i<=l-1;i++)
{
for(j=0;j<8;j++)
{
font[8*i+j]=font2[8*(string[i]-32)+j];
d++;
}
}
}
/**********Ham tao tre****************/
delay(unsigned int t)
{unsigned int i;
for(i=0;i<t;i++)
{};}
/*********Ham dich hien thi***********/
void dich_hien_thi()
{
unsigned int in,tg;
tg=font[0];
for(in=0;in<=d-1;in++)
{
font[in]=font[in+1];
}
font[d-1]=tg;
}
void quet(unsigned char n)
{
for(k=0;k<30;k++)
{
for(j=0;j<8;j++)
{
delay(40);
P0=P2=0;
P1=font[j];
if(n==0)
{
P2=ma[j];
P0=0x00;
}
if(n==1)
{
P0=ma[j];
P2=0x00;
}
if(n==2)
{
P0=P2=ma[j];
}
}
}
dich_hien_thi();
}
/********Chuong trinh chinh*********/
void main(void)
{
xuly();
while(1)
{
for(i=1;i<strlen(string)*8;i++)
quet(0);
for(i=1;i<strlen(string)*8;i++)
quet(1);
for(i=1;i<strlen(string)*8;i++)
quet(2);
}
}
#include<REG52.h>
#include<string.h>
#include<stdio.h>
#include<font.c>
int j,k;
unsigned char x,i;
unsigned char string[]="DH CONG NGHIEP HA NOI ";
unsigned char idata font[200];
unsigned char ma[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
int d=0;
/***********Ham xu ly ki tu***********/
void xuly()
{
unsigned int i,j,l;
l=strlen(string);// l la do dai cua xau ki tu
for(i=0;i<=l-1;i++)
{
for(j=0;j<8;j++)
{
font[8*i+j]=font2[8*(string[i]-32)+j];
d++;
}
}
}
/**********Ham tao tre****************/
delay(unsigned int t)
{unsigned int i;
for(i=0;i<t;i++)
{};}
/*********Ham dich hien thi***********/
void dich_hien_thi()
{
unsigned int in,tg;
tg=font[0];
for(in=0;in<=d-1;in++)
{
font[in]=font[in+1];
}
font[d-1]=tg;
}
void quet(unsigned char n)
{
for(k=0;k<30;k++)
{
for(j=0;j<8;j++)
{
delay(40);
P0=P2=0;
P1=font[j];
if(n==0)
{
P2=ma[j];
P0=0x00;
}
if(n==1)
{
P0=ma[j];
P2=0x00;
}
if(n==2)
{
P0=P2=ma[j];
}
}
}
dich_hien_thi();
}
/********Chuong trinh chinh*********/
void main(void)
{
xuly();
while(1)
{
for(i=1;i<strlen(string)*8;i++)
quet(0);
for(i=1;i<strlen(string)*8;i++)
quet(1);
for(i=1;i<strlen(string)*8;i++)
quet(2);
}
}
Comment