các bậc tiền bối chỉ dum em doan code dưới này với.
em mới học nên không hiểu. neu em thay doi chu I LOVE YOU thanh tu EM YEU thi viet nhu the nao? chi giup em phan code nay voi.
#include <16f877a.h>
#fuses HS,NOLVP,NOWDT
#use delay(clock=4000000)
#byte portb=0x06
#bit ser=0x06.0
#bit sck=0x06.1
#bit sclr=0x06.2
#bit rck=0x06.3
void out_595(unsigned char so1,unsigned char so2);
void init_595();
char const bangma[]=
{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x3c,0x00,0x00,0x3c,0xff,0xff,0xff,0xff, //I
0x00,0x00,0xfc,0xfc,0xfc,0xff,0xff,0xff, //L
0x81,0x00,0x3c,0x3c,0x00,0x81,0xff,0xff, //O
0x03,0x01,0xfc,0xfc,0x01,0x03,0xff,0xff, //V
0x00,0x00,0x24,0x24,0x3c,0xff,0xff,0xff, //E
0x1f,0x0f,0xc0,0xc0,0x0f,0x1f,0xff,0xff, //Y
0x81,0x00,0x3c,0x3c,0x00,0x81,0xff,0xff, //O
0x01,0x00,0xfc,0xfc,0x00,0x01,0xff,0xff, //U
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
char const cot[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void main()
{
int i,j,dem,chu1,chu2;
set_tris_b(0x00);//dau vao
set_tris_d(0x00);
init_595();
while(1)
for(j=0;j<=80;j++)
for(dem=0;dem<=4;dem++)
for(i=0;i<=7;i++)
{
output_d(cot[i]);
chu1=bangma[i+j];
chu2=bangma[i+j+8];
out_595(chu2,chu1);
delay_us(500);
}
}
void out_595(unsigned char so1,unsigned char so2)
{
int i;
int16 data;
data=so1;//chu 1
data=(data<<8)+so2;
sclr=1;//xuat du lieu
for(i=1;i<=16;i++)
{
if(data & 0x8000)
ser=1;
else
ser=0;
sck=1;
sck=0;
data=data<<1;
}
rck=1;khi het 16bit
rck=0;
sclr=0;//xoa du lieu
}
void init_595()
{
ser=0;
rck=0;
sck=0;
sclr=1;
}
em mới học nên không hiểu. neu em thay doi chu I LOVE YOU thanh tu EM YEU thi viet nhu the nao? chi giup em phan code nay voi.
#include <16f877a.h>
#fuses HS,NOLVP,NOWDT
#use delay(clock=4000000)
#byte portb=0x06
#bit ser=0x06.0
#bit sck=0x06.1
#bit sclr=0x06.2
#bit rck=0x06.3
void out_595(unsigned char so1,unsigned char so2);
void init_595();
char const bangma[]=
{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x3c,0x00,0x00,0x3c,0xff,0xff,0xff,0xff, //I
0x00,0x00,0xfc,0xfc,0xfc,0xff,0xff,0xff, //L
0x81,0x00,0x3c,0x3c,0x00,0x81,0xff,0xff, //O
0x03,0x01,0xfc,0xfc,0x01,0x03,0xff,0xff, //V
0x00,0x00,0x24,0x24,0x3c,0xff,0xff,0xff, //E
0x1f,0x0f,0xc0,0xc0,0x0f,0x1f,0xff,0xff, //Y
0x81,0x00,0x3c,0x3c,0x00,0x81,0xff,0xff, //O
0x01,0x00,0xfc,0xfc,0x00,0x01,0xff,0xff, //U
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
char const cot[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void main()
{
int i,j,dem,chu1,chu2;
set_tris_b(0x00);//dau vao
set_tris_d(0x00);
init_595();
while(1)
for(j=0;j<=80;j++)
for(dem=0;dem<=4;dem++)
for(i=0;i<=7;i++)
{
output_d(cot[i]);
chu1=bangma[i+j];
chu2=bangma[i+j+8];
out_595(chu2,chu1);
delay_us(500);
}
}
void out_595(unsigned char so1,unsigned char so2)
{
int i;
int16 data;
data=so1;//chu 1
data=(data<<8)+so2;
sclr=1;//xuat du lieu
for(i=1;i<=16;i++)
{
if(data & 0x8000)
ser=1;
else
ser=0;
sck=1;
sck=0;
data=data<<1;
}
rck=1;khi het 16bit
rck=0;
sclr=0;//xoa du lieu
}
void init_595()
{
ser=0;
rck=0;
sck=0;
sclr=1;
}
Comment