PIC Vietnam

Go Back   PIC Vietnam > Mua bán & Trao đổi > Trao đổi ngoài luồng

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Tìm Kiếm Bài Trong Ngày Ðánh Dấu Ðã Ðọc Vi điều khiển

Trao đổi ngoài luồng Các loại vi điều khiển khác, tản mạn của các anh chàng và cô nàng kỹ thuật ...

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 21-12-2010, 01:14 PM   #1
haibang
Nhập môn đệ tử
 
Tham gia ngày: Aug 2008
Bài gửi: 1
:
Cần giúp đỡ

Ai rành về C, giải thích hộ mình đoạn code này, hoặc chuyền no sang ASM càng tốt, vì mình kô biết lập trình C

#include <REG51.H>
#define DISPL 80
#define MESS 984 // 984 bytes
#define DATAP P1

void DISP_SHOW();
void DISP_LOAD_BYTE(unsigned char A, unsigned char D);
void DISP_LOAD_BLOCK(unsigned char bf, unsigned char bt);
void DISP_LSHIFT(unsigned char DATA);
void DEL(int x);

code at 0x300 char MESSAGE[MESS]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x7E,0xFF,0x81,0x81,0xC3,0x42,0x00,
0x00,0x7E,0xFF,0x81,0x81,0xFF,0x7E,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,
0x00,0x7E,0xFF,0x81,0xB1,0xF3,0x72,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0x0F,0x1F,0xF0,0xF0,0x1F,0x0F,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0xFE,0xFF,0x07,0x18,0x07,0xFF,0xFE,0x00,
0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0x1F,0x7F,0xC0,0xC0,0x7F,0x1F,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xFF,0xFF,0x80,0x80,0xC0,0xC0,0x00,
0x00,0xFC,0xFE,0x23,0x23,0xFE,0xFC,0x00,
0x00,0xFF,0xFF,0x11,0x11,0x1F,0x0E,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0xFF,0xFF,0x31,0x71,0xDF,0x8E,0x00,
0x00,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x7E,0xFF,0x81,0x81,0xC3,0x42,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,
0x00,0x7F,0xFF,0x80,0x80,0xFF,0x7F,0x00,
0x00,0x0F,0x1F,0xF0,0xF0,0x1F,0x0F,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,
0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xFF,0xFF,0x3C,0x66,0xC3,0x81,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x3F,0xFF,0xC0,0x30,0xC0,0xFF,0x3F,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,
0x00,0xFF,0xFF,0x89,0x89,0xFF,0x76,0x00,
0x00,0x46,0xCF,0x99,0x99,0xFB,0x72,0x00,
0x00,0xFF,0xFF,0x00,
0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x7E,0xFF,0x81,0xB1,0xF3,0x72,0x00,
0x00,0xFF,0xFF,0x00,
0x00,0xFC,0xFE,0x23,0x23,0xFE,0xFC,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x7E,0xFF,0x81,0x81,0xC3,0x42,0x00,
0x00,0x7E,0xFF,0x81,0x81,0xFF,0x7E,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,
0x00,0x7E,0xFF,0x81,0xB1,0xF3,0x72,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xFF,0xFF,0x11,0x11,0x1F,0x0E,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,
0x00,0xFC,0xFE,0x23,0x23,0xFE,0xFC,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0xFE,0xFF,0x07,0x18,0x07,0xFF,0xFE,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,
0xFE,0xFF,0x07,0x18,0x07,0xFF,0xFE,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xFF,0xFF,0x81,0x81,0x7E,0x3C,0x00,
0x00,0xFF,0xFF,0x99,0x99,0xC3,0xC3,0x00,
0x00,0x46,0xCF,0x99,0x99,0xFB,0x72,0x00,
0x00,0xFF,0xFF,0x00,
0x00,0x7E,0xFF,0x81,0xB1,0xF3,0x72,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xFF,0xFF,0x89,0x89,0xFF,0x76,0x00,
0x00,0x0F,0x1F,0xF0,0xF0,0x1F,0x0F,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x03,0x03,0xFF,0xFF,0x03,0x03,0x00,
0x00,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x00,
0x00,0x7F,0xFF,0x80,0x80,0xFF,0x7F,0x00,
0x00,0x7E,0xFF,0x81,0x81,0xFF,0x7E,0x00,
0x00,0xFF,0xFF,0x0E,0x70,0xFF,0xFF,0x00,
0x00,0x7E,0xFF,0x81,0xB1,0xF3,0x72,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
unsigned char MEMORY[DISPL]={
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0};

void main (void) {
unsigned int N=0;
P1=0;
P3=255;
N=0;
DISP_LOAD_BLOCK(0, DISPL-1);
while(1){
while(P3_7);
while(!P3_7);
DISP_SHOW();
DISP_LSHIFT(MESSAGE[N]);
N++;
N=N%MESS;
}
}

void DISP_LOAD_BYTE(unsigned char A, unsigned char D)
{
MEMORY[A]=D;
}

void DISP_LOAD_BLOCK(unsigned char bf, unsigned char bt)
{
int I;
for(I-bf;I<bt;I++)
MEMORY[I]= MESSAGE[I];
}
void DISP_SHOW()
{
int I;
for(I-1;I<DISPL+1;I++){
DATAP= MEMORY[DISPL-I];
DEL(20);}
DATAP=0;
}

void DISP_LSHIFT(unsigned char DATA)
{
int I;
for(I=0;I<(DISPL-1);I++)
MEMORY[I]=MEMORY[I+1];
MEMORY[DISPL-1]=DATA;
}

void DEL(int x)
{
int I;
for(I=0;I<x;I++)
I=I+0;
}
haibang vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 

Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 01:56 PM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam