Cám ơn ban NgoHaiBac về bài viết trên . Mình mới vừa chập chững bước vào phần mềm này . Mong bạn hướng dẫn tiếp . Cám ơn nhiều .
Thông báo
Collapse
No announcement yet.
HƯỚNG DẪN LẬP TRÌNH KEIL C CHO 8051-[Chỉ dành post bài hướng dẫn]
Collapse
X
-
Nguyên văn bởi tntiam Xem bài viết#include <REGX52.H>
#include <stdlib.h>
unsigned int i,j,k,n;
sbit c1 = P1^0;
sbit c2 = P1^1;
sbit c3 = P1^2;
sbit c4 = P1^3;
sbit c5 = P1^4;
sbit c6 = P1^5;
sbit c7 = P1^6;
sbit c8 = P1^7;
sbit c9 = P2^0;
sbit c10 = P2^1;
sbit c11 = P2^2;
sbit c12 = P2^3;
sbit c13 = P2^4;
sbit c14 = P2^5;
sbit c15 = P2^6;
sbit c16 = P2^7;
sbit c17 = P3^0;
sbit c18 = P3^1;
sbit c19 = P3^2;
sbit c20 = P3^3;
sbit c21 = P3^4;
sbit c22 = P3^5;
sbit c23 = P3^6;
sbit c24 = P3^7;
sbit c25 = P0^7;
sbit L1 = P0^4;
sbit L2 = P0^3;
sbit L3 = P0^2;
sbit L4 = P0^1;
sbit L5 = P0^0;
//=======================================
void tre(unsigned int t)
{
unsigned int i;
for(i=0;i<=t;i++);
}
//---------------------------------------
void tatcacot()
{
P1=P2=P3=0x00;c25=0;
}
//---------------------------------------
void xoatatcacot()
{
P1=P2=P3=0xff;c25=1;
}
//---------------------------------------
void xoa()
{
P0=P1=P2=P3=0xff;
}
//---------------------------------------
void toara(unsigned int time, unsigned char n)
{
xoa();
for(i=0;i<=n;i++)
{
L1=L2=L3=L4=L5=0;c13=0;tre(time);
xoa();
L1=L2=L3=L4=L5=0;c7=c8=c9=c12=c14=c17=c18=c19=0;tr e(time);
xoa();
L1=L2=L3=L4=L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c2 4=c23=c22=c21=c16=c11=c6=0;tre(time);
xoa();
}
}
//----------------------------------------
void sangdan(unsigned int time, unsigned char n)
{
for(i=0;i<=n;i++)
{
xoa();
L1=L2=L3=L4=L5=0;
c13=0;tre(time);c18=0;tre(time);c19=0;tre(time);c1 4=0;tre(time);
c9=0; tre(time);c8=0; tre(time);c7=0; tre(time);c12=0;tre(time);
c17=0;tre(time);c22=0;tre(time);c23=0;tre(time);c2 4=0;tre(time);
c25=0;tre(time);c20=0;tre(time);c15=0;tre(time);c1 0=0;tre(time);
c5=0; tre(time);c4=0; tre(time);c3=0; tre(time);c2=0; tre(time);
c1=0; tre(time);c6=0; tre(time);c11=0;tre(time);c16=0;tre(time);
c21=0;tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c21=0;tre(time);
c16=0;tre(time);c11=0;tre(time); c6=0; tre(time);c1=0; tre(time);
c2=0; tre(time);c3=0; tre(time);c4=0; tre(time);c5=0; tre(time);
c10=0;tre(time);c15=0;tre(time);c20=0;tre(time);c2 5=0;tre(time);
c24=0;tre(time);c23=0;tre(time);c22=0;tre(time);c1 7=0;tre(time);
c12=0;tre(time);c7=0; tre(time);c8=0; tre(time);c9=0; tre(time);
c14=0;tre(time);c19=0;tre(time);c18=0;tre(time);c1 3=0;tre(time);
}
}
//----------------------------------------
void nuocdang(unsigned int time, unsigned char n)
{
unsigned char M[5]={0xfe,0xfd,0xfb,0xf7,0xef};
xoa();
for(i=0;i<=n;i++)
{
for(j=0;j<=4;j++)
{
P0=M[j];
tatcacot();
tre(time);
}
}
}
//----------------------------------------
void choptat(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
P0=P1=P2=P3=0;tre(time);
xoa();tre(time);
}
}
//----------------------------------------
void quaydung(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
xoa();
L1=L2=L3=L4=L5=0;
c11=c12=c13=c14=c15=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c6=c13=c20=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c1=c7=c13=c19=c25=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c2=c13=c24=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c3=c8=c13=c18=c23=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c4=c13=c22=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c5=c9=c13=c17=c21=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c16=c13=c10=0;
tre(time);
}
}
//----------------------------------------
void quaydung2(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
xoa();
L1=L2=L3=L4=L5=0;
c11=c12=c13=c14=c15=0;
c3=c8=c13=c18=c23=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c6=c13=c20=0;
c22=c13=c4=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c1=c7=c13=c19=c25=0;
c21=c17=c13=c9=c5=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c2=c13=c24=0;
c16=c13=c10=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c3=c8=c13=c18=c23=0;
c11=c12=c13=c14=c15=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c4=c13=c22=0;
c6=c13=c20=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c5=c9=c13=c17=c21=0;
c1=c7=c13=c19=c25=0;
tre(time);
xoa();
L1=L2=L3=L4=L5=0;
c16=c13=c10=0;
c2=c13=c24=0;
tre(time);
}
}
//----------------------------------------
void xeptang(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
xoa();
L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22=c2 1=c16=c11=c6=0;tre(time);
L4=L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22 =c21=c16=c11=c6=0;tre(time);
L3=L4=L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23= c22=c21=c16=c11=c6=0;tre(time);
L2=L3=L4=L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c 23=c22=c21=c16=c11=c6=0;tre(time);
L1=L2=L3=L4=L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c2 4=c23=c22=c21=c16=c11=c6=0;tre(time);
}
}
//----------------------------------------
void luonsong(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
xoa();
for(k=0;k<time;k++)
{
L5=0;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=0;tre(50);
L5=1;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=1;tre(50);
L4=0;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=0;tre(50) ;
L4=1;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=1;tre(50) ;
L1=0;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=0;tre(50);
L1=1;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=1;tre(50);
L2=0;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=0;tre(50) ;
L2=1;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=1;tre(50) ;
}
for(k=0;k<time;k++)
{
L4=0;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=0;tre(50);
L4=1;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=1;tre(50);
L5=0;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=0;tre(50) ;
L5=1;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=1;tre(50) ;
L2=0;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=0;tre(50);
L2=1;c1=c2=c3=c4=c5=c11=c12=c13=c14=c15=c21=c22=c2 3=c24=c25=1;tre(50);
L1=0;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=0;tre(50) ;
L1=1;c6=c7=c8=c9=c10=c16=c17=c18=c19=c20=1;tre(50) ;
}
}
}
//----------------------------------------
void chu_I(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c1=c2=c3=c4=c5=0;tre(20);
xoa();
L2=0;c3=0;tre(20);
xoa();
L3=0;c3=0;tre(20);
xoa();
L4=0;c3=0;tre(20);
xoa();
L5=0;c1=c2=c3=c4=c5=0;tre(20);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c6=c7=c8=c9=c10=0;tre(20);
xoa();
L2=0;c8=0;tre(20);
xoa();
L3=0;c8=0;tre(20);
xoa();
L4=0;c8=0;tre(20);
xoa();
L5=0;c6=c7=c8=c9=c10=0;tre(20);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L2=0;c13=0;tre(20);
xoa();
L3=0;c13=0;tre(20);
xoa();
L4=0;c13=0;tre(20);
xoa();
L5=0;c11=c12=c13=c14=c15=0;tre(20);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c16=c17=c18=c19=c20=0;tre(20);
xoa();
L2=0;c18=0;tre(20);
xoa();
L3=0;c18=0;tre(20);
xoa();
L4=0;c18=0;tre(20);
xoa();
L5=0;c16=c17=c18=c19=c20=0;tre(20);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c21=c22=c23=c24=c25=0;tre(20);
xoa();
L2=0;c23=0;tre(20);
xoa();
L3=0;c23=0;tre(20);
xoa();
L4=0;c23=0;tre(20);
xoa();
L5=0;c21=c22=c23=c24=c25=0;tre(20);
}
}
}
//----------------------------------------
void chu_L(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c1=c2=c3=c4=c5=0;tre(50);
xoa();
L2=0;c1=0;tre(50);
xoa();
L3=0;c1=0;tre(50);
xoa();
L4=0;c1=0;tre(50);
xoa();
L5=0;c1=0;tre(50);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c6=c7=c8=c9=c10=0;tre(50);
xoa();
L2=0;c6=0;tre(50);
xoa();
L3=0;c6=0;tre(50);
xoa();
L4=0;c6=0;tre(50);
xoa();
L5=0;c6=0;tre(50);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c11=c12=c13=c14=c15=0;tre(50);
xoa();
L2=0;c11=0;tre(50);
xoa();
L3=0;c11=0;tre(50);
xoa();
L4=0;c11=0;tre(50);
xoa();
L5=0;c11=0;tre(50);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c16=c17=c18=c19=c20=0;tre(50);
xoa();
L2=0;c16=0;tre(50);
xoa();
L3=0;c16=0;tre(50);
xoa();
L4=0;c16=0;tre(50);
xoa();
L5=0;c16=0;tre(50);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c21=c22=c23=c24=c25=0;tre(50);
xoa();
L2=0;c21=0;tre(50);
xoa();
L3=0;c21=0;tre(50);
xoa();
L4=0;c21=0;tre(50);
xoa();
L5=0;c21=0;tre(50);
}
}
}
//----------------------------------------
void chu_O(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c2=c3=c4=0;tre(50);
xoa();
L2=0;c1=c5=0;tre(50);
xoa();
L3=0;c1=c5=0;tre(50);
xoa();
L4=0;c1=c5=0;tre(50);
xoa();
L5=0;c2=c3=c4=0;tre(50);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c7=c8=c9=0;tre(50);
xoa();
L2=0;c6=c10=0;tre(50);
xoa();
L3=0;c6=c10=0;tre(50);
xoa();
L4=0;c6=c10=0;tre(50);
xoa();
L5=0;c7=c8=c9=0;tre(50);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c12=c13=c14=0;tre(50);
xoa();
L2=0;c11=c15=0;tre(50);
xoa();
L3=0;c11=c15=0;tre(50);
xoa();
L4=0;c11=c15=0;tre(50);
xoa();
L5=0;c12=c13=c14=0;tre(50);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c17=c18=c19=0;tre(50);
xoa();
L2=0;c16=c20=0;tre(50);
xoa();
L3=0;c16=c20=0;tre(50);
xoa();
L4=0;c16=c20=0;tre(50);
xoa();
L5=0;c17=c18=c19=0;tre(50);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c22=c23=c24=0;tre(50);
xoa();
L2=0;c21=c25=0;tre(50);
xoa();
L3=0;c21=c25=0;tre(50);
xoa();
L4=0;c21=c25=0;tre(50);
xoa();
L5=0;c22=c23=c24=0;tre(50);
}
}
}
//----------------------------------------
void chu_V(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c3=0;tre(50);
xoa();
L2=0;c2=c4=0;tre(50);
xoa();
L3=0;c1=c5=0;tre(50);
xoa();
L4=0;c1=c5=0;tre(50);
xoa();
L5=0;c1=c5=0;tre(50);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c8=0;tre(50);
xoa();
L2=0;c7=c9=0;tre(50);
xoa();
L3=0;c6=c10=0;tre(50);
xoa();
L4=0;c6=c10=0;tre(50);
xoa();
L5=0;c6=c10=0;tre(50);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c13;tre(50);
xoa();
L2=0;c12=c14=0;tre(50);
xoa();
L3=0;c11=c15=0;tre(50);
xoa();
L4=0;c11=c15=0;tre(50);
xoa();
L5=0;c11=c15=0;tre(50);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c18=0;tre(50);
xoa();
L2=0;c17=c19=0;tre(50);
xoa();
L3=0;c16=c20=0;tre(50);
xoa();
L4=0;c16=c20=0;tre(50);
xoa();
L5=0;c16=c20=0;tre(50);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c23=0;tre(50);
xoa();
L2=0;c22=c24=0;tre(50);
xoa();
L3=0;c21=c25=0;tre(50);
xoa();
L4=0;c21=c25=0;tre(50);
xoa();
L5=0;c21=c25=0;tre(50);
}
}
}
//----------------------------------------
void chu_E(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c1=c2=c3=c4=c5=0;tre(50);
xoa();
L2=0;c1=0;tre(50);
xoa();
L3=0;c1=c2=c3=c4=c5=0;tre(50);
xoa();
L4=0;c1=0;tre(50);
xoa();
L5=0;c1=c2=c3=c4=c5=0;tre(50);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c6=c7=c8=c9=c10=0;tre(50);
xoa();
L2=0;c6=0;tre(50);
xoa();
L3=0;c6=c7=c8=c9=c10=0;tre(50);
xoa();
L4=0;c6=0;tre(50);
xoa();
L5=0;c6=c7=c8=c9=c10=0;tre(50);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c11=c12=c13=c14=c15=0;tre(50);
xoa();
L2=0;c11=0;tre(50);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(50);
xoa();
L4=0;c11=0;tre(50);
xoa();
L5=0;c11=c12=c13=c14=c15=0;tre(50);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c16=c17=c18=c19=c20=0;tre(50);
xoa();
L2=0;c16=0;tre(50);
xoa();
L3=0;c16=c17=c18=c19=c20=0;tre(50);
xoa();
L4=0;c16=0;tre(50);
xoa();
L5=0;c16=c17=c18=c19=c20=0;tre(50);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c21=c22=c23=c24=c25=0;tre(50);
xoa();
L2=0;c21=0;tre(50);
xoa();
L3=0;c21=c22=c23=c24=c25=0;tre(50);
xoa();
L4=0;c21=0;tre(50);
xoa();
L5=0;c21=c22=c23=c24=c25=0;tre(50);
}
}
}
//----------------------------------------
void chu_Y(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c1=0;tre(50);
xoa();
L2=0;c2=0;tre(50);
xoa();
L3=0;c3=0;tre(50);
xoa();
L4=0;c2=c4=0;tre(50);
xoa();
L5=0;c1=c5=0;tre(50);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c6=0;tre(50);
xoa();
L2=0;c7=0;tre(50);
xoa();
L3=0;c8=0;tre(50);
xoa();
L4=0;c7=c9=0;tre(50);
xoa();
L5=0;c6=c10=0;tre(50);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c11=0;tre(50);
xoa();
L2=0;c12=0;tre(50);
xoa();
L3=0;c13=0;tre(50);
xoa();
L4=0;c12=c14=0;tre(50);
xoa();
L5=0;c11=c15=0;tre(50);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c16=0;tre(50);
xoa();
L2=0;c17=0;tre(50);
xoa();
L3=0;c18=0;tre(50);
xoa();
L4=0;c17=c19=0;tre(50);
xoa();
L5=0;c16=c20=0;tre(50);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c21=0;tre(50);
xoa();
L2=0;c22=0;tre(50);
xoa();
L3=0;c23=0;tre(50);
xoa();
L4=0;c22=c24=0;tre(50);
xoa();
L5=0;c21=c25=0;tre(50);
}
}
}
//----------------------------------------
void chu_U(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
//1
for(k=0;k<time;k++)
{
xoa();
L1=0;c2=c3=c4=0;tre(50);
xoa();
L2=0;c1=c5=0;tre(50);
xoa();
L3=0;c1=c5=0;tre(50);
xoa();
L4=0;c1=c5=0;tre(50);
xoa();
L5=0;c1=c5=0;tre(50);
}
//2
for(k=0;k<time;k++)
{
xoa();
L1=0;c7=c8=c9=0;tre(50);
xoa();
L2=0;c6=c10=0;tre(50);
xoa();
L3=0;c6=c10=0;tre(50);
xoa();
L4=0;c6=c10=0;tre(50);
xoa();
L5=0;c6=c10=0;tre(50);
}
//3
for(k=0;k<time;k++)
{
xoa();
L1=0;c12=c13=c14=0;tre(50);
xoa();
L2=0;c11=c15=0;tre(50);
xoa();
L3=0;c11=c15=0;tre(50);
xoa();
L4=0;c11=c15=0;tre(50);
xoa();
L5=0;c11=c15=0;tre(50);
}
//4
for(k=0;k<time;k++)
{
xoa();
L1=0;c17=c18=c19=0;tre(50);
xoa();
L2=0;c16=c20=0;tre(50);
xoa();
L3=0;c16=c20=0;tre(50);
xoa();
L4=0;c16=c20=0;tre(50);
xoa();
L5=0;c16=c20=0;tre(50);
}
//5
for(k=0;k<time;k++)
{
xoa();
L1=0;c22=c23=c24=0;tre(50);
xoa();
L2=0;c21=c25=0;tre(50);
xoa();
L3=0;c21=c25=0;tre(50);
xoa();
L4=0;c21=c25=0;tre(50);
xoa();
L5=0;c21=c25=0;tre(50);
}
}
}
//----------------------------------------
void phaohoa(unsigned int time,unsigned char n)
{
xoa();
for(i=0;i<n;i++)
{
xoa();
L3=0;c13=0;
tre(time);
for(k=0;k<100;k++)
{
xoa();
L2=0;c7=c8=c9=c14=c19=c18=c17=c12=0;tre(50);
xoa();
L3=0;c7=c8=c9=c14=c19=c18=c17=c12=0;tre(50);
xoa();
L4=0;c7=c8=c9=c14=c19=c18=c17=c12=0;tre(50);
}
tre(time);
for(k=0;k<100;k++)
{
xoa();
L1=0;tatcacot();tre(50);
xoa();
L2=0;tatcacot();tre(50);
xoa();
L3=0;tatcacot();tre(50);
xoa();
L4=0;tatcacot();tre(50);
xoa();
L5=0;tatcacot();tre(50);
}
tre(time);
}
}
//----------------------------------------
void quayngang(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
for(k=0;k<time;k++)
{
xoa();
L3=0;tatcacot();tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L2=0;c1=c2=c3=c4=c5=0;tre(20);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L4=0;c21=c22=c23=c24=c25=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L1=0;c1=c2=c3=c4=c5=0;tre(20);
xoa();
L2=0;c6=c7=c8=c9=c10=0;tre(20);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L4=0;c16=c17=c18=c19=c20=0;tre(20);
xoa();
L5=0;c21=c22=c23=c24=c25=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L1=0;c6=c7=c8=c9=c10=0;tre(20);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L5=0;c16=c17=c18=c19=c20=c25=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L1=L2=L3=L4=L5=0;c11=c12=c13=c14=c15=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L1=0;c16=c17=c18=c19=c20=0;tre(20);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L5=0;c6=c7=c8=c9=c10=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L1=0;c21=c22=c23=c24=c25=0;tre(20);
xoa();
L2=0;c16=c17=c18=c19=c20=0;tre(20);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L4=0;c6=c7=c8=c9=c10=0;tre(20);
xoa();
L5=0;c1=c2=c3=c4=c5=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L2=0;c21=c22=c23=c24=c25=0;tre(20);
xoa();
L3=0;c11=c12=c13=c14=c15=0;tre(20);
xoa();
L4=0;c1=c2=c3=c4=c5=0;tre(20);
}
for(k=0;k<time;k++)
{
xoa();
L3=0;tatcacot();tre(20);
}
}
}
//----------------------------------------
void banphao(unsigned int time,unsigned char n)
{
for(i=0;i<n;i++)
{
xoa();
c13=0;L1=0;tre(time);L1=1;L2=0;tre(time);L2=1;
L3=0;tre(time);L3=1;L4=0;tre(time);L4=1;L5=0;tre(t ime);L5=1;
xoa();
L5=0;c7=c8=c9=c14=c19=c18=c17=c12=0;tre(time);
xoa();
L5=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22=c2 1=c16=c11=c6=0;tre(time);
xoa();
L4=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22=c2 1=c16=c11=c6=0;tre(time);
xoa();
L3=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22=c2 1=c16=c11=c6=0;tre(time);
xoa();
L2=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22=c2 1=c16=c11=c6=0;tre(time);
xoa();
L1=0;c1=c2=c3=c4=c5=c10=c15=c20=c25=c24=c23=c22=c2 1=c16=c11=c6=0;tre(time);
}
}
//========================================
void main()
{
while(1)
{
toara(20000,5);
sangdan(10000,1);
nuocdang(15000,3);
nuocdang(10000,3);
nuocdang(5000,5);
nuocdang(3000,5);
quaydung(20000,3);
quaydung(10000,3);
quaydung(5000,5);
quaydung(3000,10);
choptat(10000,5);
xeptang(30000,5);
luonsong(50,10);
chu_I(50,1);
chu_L(50,1);
chu_O(50,1);
chu_V(50,1);
chu_E(50,1);
chu_Y(50,1);
chu_O(50,1);
chu_U(50,1);
phaohoa(8000,5);
quayngang(100,10);
quayngang(50,20);
toara(20000,3);
quaydung2(20000,5);
quaydung2(10000,8);
banphao(8000,10);
chu_I(50,1);
chu_L(50,1);
chu_O(50,1);
chu_V(50,1);
chu_E(50,1);
chu_Y(50,1);
chu_O(50,1);
chu_U(50,1);
banphao(8000,10);
}
}
//trên là ct viết cho 89s52 điều khiển led cube 5x5x5. em lấy nguyên văn trên mạng rồi về chạy sang file .H nhưng không được.
Comment
-
Nguyên văn bởi an_87pt Xem bài viếtCác anh giứp em ,mã code asm này với ! Em còn gà lắm . Em muốn nó chạy từ đầu đến cuối chương trình rồi nó kết thúc . " ko lập lại chu kỳ cám ơn " ! em phải thêm gì ở đâu và sửa như thế nào ?
ORG 0000H
;================================================= =========================
BAT_DAU_NHAY:
;Dong:1
MOV P0,#00000001B
CALL Delay_2
;Dong:2
MOV P0,#00000000B
CALL Delay_2
;Dong:3
MOV P0,#00001000B
CALL Delay_2
;Dong:4
MOV P0,#00000000B
CALL Delay_60
;Dong:5
MOV P0,#00000001B
CALL Delay_2
;Dong:6
MOV P0,#00000000B
CALL Delay_2
;Dong:7
MOV P0,#00000001B
CALL Delay_2
;Dong:8
MOV P0,#00000000B
CALL Delay_2
;Dong:9
MOV P0,#00000010B
CALL Delay_2
;Dong:10
MOV P0,#00000000B
CALL Delay_2
;Dong:11
MOV P0,#00000010B
CALL Delay_2
;Dong:12
MOV P0,#00000000B
CALL Delay_2
;Dong:13
MOV P0,#00000010B
CALL Delay_2
;Dong:14
MOV P0,#00000000B
CALL Delay_2
;Dong:15
MOV P0,#00000001B
CALL Delay_2
;Dong:16
MOV P0,#00000000B
CALL Delay_2
;Dong:17
MOV P0,#00000001B
CALL Delay_2
;Dong:18
MOV P0,#00000000B
CALL Delay_2
;Dong:19
MOV P0,#00000001B
CALL Delay_2
;Dong:20
MOV P0,#00000000B
CALL Delay_2
;Dong:21
MOV P0,#00000010B
CALL Delay_2
;Dong:22
MOV P0,#00000000B
CALL Delay_2
;Dong:23
MOV P0,#00000010B
CALL Delay_2
;Dong:24
MOV P0,#00000000B
CALL Delay_2
;Dong:25
MOV P0,#00000010B
CALL Delay_2
;Dong:26
MOV P0,#00000000B
CALL Delay_2
;Dong:27
MOV P0,#00000001B
CALL Delay_2
;Dong:28
MOV P0,#00000000B
CALL Delay_2
;Dong:29
MOV P0,#00000001B
CALL Delay_2
;Dong:30
MOV P0,#00000000B
CALL Delay_2
;Dong:31
MOV P0,#00000001B
CALL Delay_2
;Dong:32
MOV P0,#00000000B
CALL Delay_2
;Dong:33
MOV P0,#00000001B
CALL Delay_2
;Dong:34
MOV P0,#00000000B
CALL Delay_60
;Dong:35
MOV P0,#00001000B
CALL Delay_2
JMP BAT_DAU_NHAY
;================================================= ===============
;-------------------------------------
;Delay 2 buoc
Delay_2:
MOV R1,#2
MOV R2,#0
MOV R3,#0
lapDelay_2:
DJNZ R3,lapDelay_2
DJNZ R2,lapDelay_2
DJNZ R1,lapDelay_2
RET
;-------------------------------------
;Delay 60 buoc
Delay_60:
MOV R1,#60
MOV R2,#0
MOV R3,#0
lapDelay_60:
DJNZ R3,lapDelay_60
DJNZ R2,lapDelay_60
DJNZ R1,lapDelay_60
RET
END
Comment
-
#include <regx51.h>
#define led P2
#define XUNG P3_7
#define bam P3_5
int x;
///////
void delay()
{
while(XUNG==1)
{
}
while(XUNG==0)
{
}
}
//////
char effect[]={0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00};
void mau()
{
for(x=0;x<8;x++)
{
led = effect[x];
delay();
}
}
//////
void main()
{
while(1)
{
if (bam==0xff)
{
mau();
}
else
{
led=0xfe;
led=0xfd;
led=0xfb;
led=0xf7;
led=0xef;
led=0xdf;
led=0xbf;
led=0x7f;
}
}
}
Comment
Bài viết mới nhất
Collapse
-
Trả lời cho tìm mua đồng hồ vạn năngbởi matnetgia99Ồ, cái này mình cũng có nè, có ai mua không, đồ cũ dùng từ năm 2008, hư 1 2 giai gì đấy bỏ xó hơn năm nay...
-
Channel: Điện tử dành cho người mới bắt đầu
hôm nay, 14:40 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi dinhthuong80À, sản phẩm họ thiết kế ra, họ yêu cầu mình chứng minh là sau chỉnh sửa thì 1 là gỡ jump cắm lại không hư mạch, 2 là gỡ jump thì 220Vdc vẫn dùng được led áp thấp 20V mà không hư led như mình báo, nên họ hiểu rõ mà....
-
Channel: Điện tử công suất
hôm nay, 06:08 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi nhathung1101Tôi biết và tôi biết.
Sẽ bắt đầu với cái Sồn La, rồi mấy mạch nguồn vớ vỉn.... Rồi sẽ đèn led...
Cuộc đời là những chuyến xe, nên sẽ có:
Xe đạp điện, xe máy điện, xe ô tô điện, xe cấp cứu điện, xe tang điện.
Rồi xem.-
Channel: Điện tử công suất
hôm nay, 01:38 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi nhathung1101Vấn đề là thu ánh sáng rồi phát ra ánh sáng cơ. Hồi mẫu giáo cô bảo đừng làm, lão không nhớ à?
Tốt nhất im mồm....-
Channel: Điện tử công suất
hôm nay, 01:26 -
-
Trả lời cho Tiếng Anh cho người Việtbởi bqvietBài học kiểu trực tuyến dù là loại đơn giản bậc nhất cũng vẫn cần chú tâm. Chỉ bật tai nghe lên thì không có loại nào thấm nổi đâu. Cách hay hơn, dễ hơn là kiếm phim tiếng Anh nào đó xem, ban đầu bật phụ đề tiếng Việt, nghe và...
-
Channel: Tâm tình dân kỹ thuật
14-02-2025, 16:15 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi nguyendinhvanỞ đtvn này mới biết đến 2 loại mạch
1 step down
2 step up
Bây giờ anh lưu vong làm thuê bên nước lạ còn làm ra cái mach vừa up vùa dow luôn.
Tính chất là:
1 Đầu vào bằn ra cho nối thẳng
2 Đầu vào cao hơn...-
Channel: Điện tử công suất
14-02-2025, 00:51 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi nguyendinhvanHa ha !
Thay đổi cách nghĩ thì sẽ nghĩ ra.
.
.
.
Một thứ cần kiểm soát dòng + nhiệt + công suất tiêu tán. Nhưng lại dùng tư duy ổn áp. Làm sao mà giải quyết được.
Nó là mạch ổn dòng.
Vì thế các anh nước lạ không thèm quan tâm là phải....-
Channel: Điện tử công suất
14-02-2025, 00:42 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi dinhthuong80Vì cứ phải chỉnh sửa cho mỗi dải điện áp, quên chỉnh thì hư chíp phải bảo hành nên em thấy bất tiện, mới cần cái mạch 1 dải áp cao dùng cho tất cả loại đèn đó bác!...
-
Channel: Điện tử công suất
13-02-2025, 17:02 -
-
Trả lời cho Tiếng Anh cho người Việtbởi hankhungdtMình thỉnh thoảng cũng làm việc với người nước ngoài nói tiếng Anh thì toàn ghép nhặt từ, cộng với quơ tay quơ chân để diễn tả, hix. Nỗi khổ là không biết cách để mô tả sự việc. Tôi muốn tìm các bài giảng tiếng anh nào phù hợp...
-
Channel: Tâm tình dân kỹ thuật
13-02-2025, 08:43 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi ti500Chúc mừng bác đã chỉnh sửa thành công, nhưng theo em thì video hơi rối nếu bác muốn gửi cho bên supplier xem.
Nếu là em thì em chỉ cần nối dây để hiển thị liên tục điện áp ở ngõ ra là 220Vdc trước khi gắn LED, kế đến là cắm...-
Channel: Điện tử công suất
13-02-2025, 07:39 -
Comment