Em đang làm đồ án môn học Vi Xữ Lý sử dụng PUC 16F877a...Tình hình la giáo viên dạy ASM mà em lai tìm được đoạn code C này...Trong này no viết chữ VIETNAM giờ em mún sữa lại chữ ĐT0A mong các anh giúp đỡ....sẵn tiện cho e hỏi khi làm mạch Quang Báo 4 led matrix thì khi sử dụng IC 595 thì có cần sữ dụng IC đệm 2803....cảm ơn các a trước
#include <16f877a.h>
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG,NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use fast_io(b)
#use fast_io(d)
#use delay(clock=20000000)
int32 send_reg;
int16 m,l,x,lap,s;
int32 const chay[]={0x80000000,0x40000000,0x20000000,0x10000000,
0x08000000,0x04000000,0x02000000,0x01000000,0x0080 0000,0x00400000,0x00200000,0x00100000,0x00080000,0 x00040000,0x00020000,0x00010000,
0x00008000,0x00004000,0x00002000,0x00001000,0x0000 0800,0x00000400,0x00000200 ,0x00000100,
0x00000080,0x00000040,0x00000020,0x00000010,0x0000 0008,0x00000004,0x00000002,0x00000001,0x00000000};
const unsigned char data[]={
//================================================== ====================
// Bitmap Data Created by RTB (c) 2009 Bui Viet Hoang
// 136 x 8 pixels - Monochrome
// Vertical Scan Lines - Left to Right, Top to Bottom
//================================================== ====================
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0x7E,0x00,0x7E,0xFF,0xFF,0xFF,0xFF, 0x00,0xFE,0xFE,0xFE,0xFF,
0xC3,0xBD,0x7E,0x7E,0x7E,0xBD,0xC3,0xFF,0x1F,0xE3, 0xFC,0xE3,0x1F,0xFF,0x00,
0x6E,0x6E,0x6E,0x7E,0xFF,0xFF,0xFF,0xFF,0x00,0x77, 0x77,0x77,0x8F,0xFF,0x7E,
0x00,0x7E,0xFF,0xC3,0xBD,0x7E,0x7E,0x7E,0x7E,0xFF, 0xFF,0xFF,0xFF,0x1F,0xE3,
0xFC,0xE3,0x1F,0xFF,0x7E,0x00,0x7E,0xFF,0x00,0x6E, 0x6E,0x6E,0x7E,0xFF,0x7F,
0x7F,0x00,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0x00,0x3F, 0xCF,0xF3,0xFC,0x00,0xFF,
0xF8,0xC3,0x3B,0x3B,0xC3,0xF8,0xFF,0x00,0x3F,0xCF, 0xF3,0xCF,0x3F,0x00,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
#bit d7=send_reg.31
void serout(){
int8 n;
for(n=0;n<=32;n++)
{
output_low(pin_b0);
if(d7!=0) output_high(pin_b0);
output_low(pin_b1);
output_high(pin_b1);
send_reg=send_reg<<1;
}
}
void display(){
output_high(pin_b2);
serout();
output_low(pin_b3);
output_high(pin_b3);
}
void hc595(){
m=32;
x=0;
for(x=0;x<=32;x++){
output_d(data[l+m]);
send_reg=chay[x];
display();
m--;
}
}
void main(){
set_tris_d(0);
output_d(255);
set_tris_b(0x00);
while(1){
l=0;
for(l=0;l<=136;l++){
for(s=0;s<=1;s++)
{
for(lap=0;lap<=3;lap++){
hc595();
}
}
}
}
}
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG,NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use fast_io(b)
#use fast_io(d)
#use delay(clock=20000000)
int32 send_reg;
int16 m,l,x,lap,s;
int32 const chay[]={0x80000000,0x40000000,0x20000000,0x10000000,
0x08000000,0x04000000,0x02000000,0x01000000,0x0080 0000,0x00400000,0x00200000,0x00100000,0x00080000,0 x00040000,0x00020000,0x00010000,
0x00008000,0x00004000,0x00002000,0x00001000,0x0000 0800,0x00000400,0x00000200 ,0x00000100,
0x00000080,0x00000040,0x00000020,0x00000010,0x0000 0008,0x00000004,0x00000002,0x00000001,0x00000000};
const unsigned char data[]={
//================================================== ====================
// Bitmap Data Created by RTB (c) 2009 Bui Viet Hoang
// 136 x 8 pixels - Monochrome
// Vertical Scan Lines - Left to Right, Top to Bottom
//================================================== ====================
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0x7E,0x00,0x7E,0xFF,0xFF,0xFF,0xFF, 0x00,0xFE,0xFE,0xFE,0xFF,
0xC3,0xBD,0x7E,0x7E,0x7E,0xBD,0xC3,0xFF,0x1F,0xE3, 0xFC,0xE3,0x1F,0xFF,0x00,
0x6E,0x6E,0x6E,0x7E,0xFF,0xFF,0xFF,0xFF,0x00,0x77, 0x77,0x77,0x8F,0xFF,0x7E,
0x00,0x7E,0xFF,0xC3,0xBD,0x7E,0x7E,0x7E,0x7E,0xFF, 0xFF,0xFF,0xFF,0x1F,0xE3,
0xFC,0xE3,0x1F,0xFF,0x7E,0x00,0x7E,0xFF,0x00,0x6E, 0x6E,0x6E,0x7E,0xFF,0x7F,
0x7F,0x00,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0x00,0x3F, 0xCF,0xF3,0xFC,0x00,0xFF,
0xF8,0xC3,0x3B,0x3B,0xC3,0xF8,0xFF,0x00,0x3F,0xCF, 0xF3,0xCF,0x3F,0x00,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
#bit d7=send_reg.31
void serout(){
int8 n;
for(n=0;n<=32;n++)
{
output_low(pin_b0);
if(d7!=0) output_high(pin_b0);
output_low(pin_b1);
output_high(pin_b1);
send_reg=send_reg<<1;
}
}
void display(){
output_high(pin_b2);
serout();
output_low(pin_b3);
output_high(pin_b3);
}
void hc595(){
m=32;
x=0;
for(x=0;x<=32;x++){
output_d(data[l+m]);
send_reg=chay[x];
display();
m--;
}
}
void main(){
set_tris_d(0);
output_d(255);
set_tris_b(0x00);
while(1){
l=0;
for(l=0;l<=136;l++){
for(s=0;s<=1;s++)
{
for(lap=0;lap<=3;lap++){
hc595();
}
}
}
}
}