em đang định làm led ma trận lên mạng em tìm code thì có đoạn code này nhưng khi vào keil c dịch sang hex thì báo lỗi AD.C(172): error C213: left side of asn-op not an lvalue các anh chỉ cho em cách sửa lỗi với ạ
code :
#include<at89x52.h>
sbit s_data=P1^0;
sbit position=P1^1;
sbit sh=P1^2;
sbit st=P1^3;
sbit r_clr=P1^4;
sbit r_ena=P1^5;
sbit b_clr=P1^6;
sbit b_ena=P1^7;
unsigned char receive=0;
unsigned char dem_array[5];
code unsigned char font[760]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x40,//!
0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,//"
0x14,0x14,0x7E,0x28,0x28,0xFC,0x50,0x50,//#
0x20,0x78,0xA0,0xA0,0x70,0x28,0x28,0xF0,//$
0x24,0x54,0x24,0x08,0x10,0x24,0x2A,0x24,//%
0x60,0x90,0x90,0x64,0x94,0x88,0x8C,0x72,//&
0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,//'
0x10,0x20,0x40,0x40,0x40,0x40,0x20,0x10,//(
0x20,0x10,0x08,0x08,0x08,0x08,0x10,0x20,//)
0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,//*
0x00,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,//+
0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,//,
0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,//-
0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,//.
0x10,0x20,0x20,0x20,0x20,0x20,0x40,0x40,///
0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,//0
0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,//1
0x70,0x88,0x08,0x10,0x20,0x40,0x80,0xF8,//2
0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,//3
0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x10,//4
0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,//5
0x30,0x40,0x80,0xF0,0x88,0x88,0x88,0x70,//6
0xF8,0x08,0x10,0x10,0x20,0x20,0x40,0x40,//7
0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,//8
0x70,0x88,0x88,0x88,0x78,0x08,0x10,0x60,//9
0x00,0x40,0x40,0x00,0x00,0x40,0x40,0x00,//:
0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x40,//;
0x00,0x02,0x0C,0x30,0x40,0x30,0x0C,0x02,//<
0x00,0x00,0x00,0xFE,0x00,0xFE,0x00,0x00,//=
0x00,0x40,0x30,0x0C,0x02,0x0C,0x30,0x40,//>
0x70,0x08,0x08,0x10,0x20,0x20,0x00,0x20,//?
0x3C,0x42,0x9A,0xAA,0xAA,0x9C,0x40,0x3C,//@
0x30,0x30,0x48,0x48,0x48,0xFC,0x84,0x84,//A
0xF0,0x88,0x88,0xF0,0x88,0x88,0x88,0xF0,//B
0x3C,0x40,0x80,0x80,0x80,0x80,0x40,0x3C,//C
0xF0,0x88,0x84,0x84,0x84,0x84,0x88,0xF0,//D
0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0xF8,//E
0xF8,0x80,0x80,0xF8,0x80,0x80,0x80,0x80,//F
0x3C,0x40,0x80,0x80,0x9C,0x84,0x44,0x3C,//G
0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,//H
0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,//I
0x7C,0x10,0x10,0x10,0x10,0x10,0x90,0x60,//J
0x88,0x90,0xA0,0xC0,0xC0,0xA0,0x90,0x88,//K
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,//L
0xC6,0xC6,0xAA,0xAA,0x92,0x92,0x82,0x82,//M
0xC4,0xC4,0xA4,0xA4,0x94,0x94,0x8C,0x8C,//N
0x38,0x44,0x82,0x82,0x82,0x82,0x44,0x38,//O
0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x80,//P
0x38,0x44,0x82,0x82,0x82,0x82,0x44,0x38,//Q
0xF0,0x88,0x88,0x88,0xF0,0x90,0x88,0x84,//R
0x78,0x80,0x80,0x70,0x08,0x08,0x08,0xF0,//S
0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,//T
0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x78,//U
0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,//V
0x81,0x81,0x99,0x99,0x99,0x5A,0x3C,0x18,//W
0x88,0x88,0x50,0x20,0x20,0x50,0x88,0x88,//X
0x88,0x88,0x50,0x50,0x20,0x20,0x20,0x20,//Y
0xF8,0x08,0x10,0x20,0x20,0x40,0x80,0xF8,//Z
0xE0,0x80,0x80,0x80,0x80,0x80,0x80,0xE0,//[
0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x10,//
//----------------------------------------------------------
0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x70,//]
0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,//^
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,//_
0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,//`
0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,//a
0x80,0x80,0xF0,0x88,0x88,0x88,0x88,0xF0,//b
0x00,0x00,0x70,0x80,0x80,0x80,0x80,0x70,//c
0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,//d
0x00,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,//e
0x60,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,//f
0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x70,//g
0x80,0x80,0x80,0xF0,0x88,0x88,0x88,0x88,//h
0x00,0x80,0x00,0x80,0x80,0x80,0xA0,0x40,//i
0x00,0x20,0x00,0x60,0x20,0x20,0xA0,0x40,//j
0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x88,//k
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,//l
0x00,0x00,0xEC,0x92,0x92,0x92,0x92,0x92,//m
0x00,0x00,0xF0,0x88,0x88,0x88,0x88,0x88,//n
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x70,//o
0x00,0xF0,0x88,0x88,0x88,0x88,0xF0,0x80,//p
0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,//q
0x00,0x00,0xA0,0xC0,0x80,0x80,0x80,0x80,//r
0x00,0x00,0x70,0x80,0xC0,0x30,0x10,0xE0,//s
0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x60,//t
0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x78,//u
0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x20,//v
0x00,0x00,0x92,0x92,0xAA,0xAA,0x44,0x44,//w
0x00,0x00,0x88,0x50,0x20,0x20,0x50,0x88,//x
0x00,0x88,0x88,0x50,0x50,0x20,0x20,0x40,//y
0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,//z
0x18,0x20,0x20,0x20,0xC0,0x20,0x20,0x18,//{
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,//|
0xC0,0x20,0x20,0x20,0x18,0x20,0x20,0xC0,//}
0x00,0x00,0x00,0x62,0x92,0x8C,0x00,0x00//~
};
unsigned char array[32]={
0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,//8
0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,//0
0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,//5
0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,//1
};
//chuong trinh tao thoi gian tre//
void delay(unsigned int time)
{
unsigned int i=0;
while(i<time) i++;
}
//------------------------------//
//chuong trinh hien thi du lieu trang array ra ma tran//
//r la bit cho phep mau do, b la bit cho phep mau xanh
void send_ar(bit r_,bit b_)
{
char i=0,j=0,k=0,temp1=0;
unsigned char temp=0;
b_ena=b_;
r_ena=r_;
for(i=7;i>=0;i--)
{
temp1=~(1<<i);
for(j=3;j>=0;j--)
{
temp=array[i+j*8];
for(k=0;k<8;k++)
{
s_data=temp&1;
temp=temp>>1;
if(j==0)
{
position=temp1&1;
temp1=temp1>>1;
}
sh=0;
sh=1;
}
}
st=0;
st=1;
delay(2);
b_clr=0;
b_clr=1;
r_clr=0;
r_clr=1;
delay(1);
}
}
//------------------------------//
//chuong trinh dich du lieu qua trai//
void shift(unsigned int start)
{
unsigned int i=0;
for(i=0;i<32;i++)
{
array = font[1+start];
}
}
//------------------------------//
main()
{
unsigned char i=0,j=0;
P0=255;
P1=255;
P2=255;
P3=255;
while(1)
{
for(j=0;j<100;j++)
{
shift(j*8);
for(i=0;i<100;i++)
{
send_ar(0,0);
}
}
}
}
code :
#include<at89x52.h>
sbit s_data=P1^0;
sbit position=P1^1;
sbit sh=P1^2;
sbit st=P1^3;
sbit r_clr=P1^4;
sbit r_ena=P1^5;
sbit b_clr=P1^6;
sbit b_ena=P1^7;
unsigned char receive=0;
unsigned char dem_array[5];
code unsigned char font[760]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x40,//!
0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,//"
0x14,0x14,0x7E,0x28,0x28,0xFC,0x50,0x50,//#
0x20,0x78,0xA0,0xA0,0x70,0x28,0x28,0xF0,//$
0x24,0x54,0x24,0x08,0x10,0x24,0x2A,0x24,//%
0x60,0x90,0x90,0x64,0x94,0x88,0x8C,0x72,//&
0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,//'
0x10,0x20,0x40,0x40,0x40,0x40,0x20,0x10,//(
0x20,0x10,0x08,0x08,0x08,0x08,0x10,0x20,//)
0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,//*
0x00,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,//+
0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,//,
0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,//-
0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,//.
0x10,0x20,0x20,0x20,0x20,0x20,0x40,0x40,///
0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,//0
0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,//1
0x70,0x88,0x08,0x10,0x20,0x40,0x80,0xF8,//2
0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,//3
0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x10,//4
0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,//5
0x30,0x40,0x80,0xF0,0x88,0x88,0x88,0x70,//6
0xF8,0x08,0x10,0x10,0x20,0x20,0x40,0x40,//7
0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,//8
0x70,0x88,0x88,0x88,0x78,0x08,0x10,0x60,//9
0x00,0x40,0x40,0x00,0x00,0x40,0x40,0x00,//:
0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x40,//;
0x00,0x02,0x0C,0x30,0x40,0x30,0x0C,0x02,//<
0x00,0x00,0x00,0xFE,0x00,0xFE,0x00,0x00,//=
0x00,0x40,0x30,0x0C,0x02,0x0C,0x30,0x40,//>
0x70,0x08,0x08,0x10,0x20,0x20,0x00,0x20,//?
0x3C,0x42,0x9A,0xAA,0xAA,0x9C,0x40,0x3C,//@
0x30,0x30,0x48,0x48,0x48,0xFC,0x84,0x84,//A
0xF0,0x88,0x88,0xF0,0x88,0x88,0x88,0xF0,//B
0x3C,0x40,0x80,0x80,0x80,0x80,0x40,0x3C,//C
0xF0,0x88,0x84,0x84,0x84,0x84,0x88,0xF0,//D
0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0xF8,//E
0xF8,0x80,0x80,0xF8,0x80,0x80,0x80,0x80,//F
0x3C,0x40,0x80,0x80,0x9C,0x84,0x44,0x3C,//G
0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,//H
0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,//I
0x7C,0x10,0x10,0x10,0x10,0x10,0x90,0x60,//J
0x88,0x90,0xA0,0xC0,0xC0,0xA0,0x90,0x88,//K
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,//L
0xC6,0xC6,0xAA,0xAA,0x92,0x92,0x82,0x82,//M
0xC4,0xC4,0xA4,0xA4,0x94,0x94,0x8C,0x8C,//N
0x38,0x44,0x82,0x82,0x82,0x82,0x44,0x38,//O
0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x80,//P
0x38,0x44,0x82,0x82,0x82,0x82,0x44,0x38,//Q
0xF0,0x88,0x88,0x88,0xF0,0x90,0x88,0x84,//R
0x78,0x80,0x80,0x70,0x08,0x08,0x08,0xF0,//S
0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,//T
0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x78,//U
0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,//V
0x81,0x81,0x99,0x99,0x99,0x5A,0x3C,0x18,//W
0x88,0x88,0x50,0x20,0x20,0x50,0x88,0x88,//X
0x88,0x88,0x50,0x50,0x20,0x20,0x20,0x20,//Y
0xF8,0x08,0x10,0x20,0x20,0x40,0x80,0xF8,//Z
0xE0,0x80,0x80,0x80,0x80,0x80,0x80,0xE0,//[
0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x10,//
//----------------------------------------------------------
0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x70,//]
0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,//^
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,//_
0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,//`
0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,//a
0x80,0x80,0xF0,0x88,0x88,0x88,0x88,0xF0,//b
0x00,0x00,0x70,0x80,0x80,0x80,0x80,0x70,//c
0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,//d
0x00,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,//e
0x60,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,//f
0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x70,//g
0x80,0x80,0x80,0xF0,0x88,0x88,0x88,0x88,//h
0x00,0x80,0x00,0x80,0x80,0x80,0xA0,0x40,//i
0x00,0x20,0x00,0x60,0x20,0x20,0xA0,0x40,//j
0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x88,//k
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,//l
0x00,0x00,0xEC,0x92,0x92,0x92,0x92,0x92,//m
0x00,0x00,0xF0,0x88,0x88,0x88,0x88,0x88,//n
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x70,//o
0x00,0xF0,0x88,0x88,0x88,0x88,0xF0,0x80,//p
0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,//q
0x00,0x00,0xA0,0xC0,0x80,0x80,0x80,0x80,//r
0x00,0x00,0x70,0x80,0xC0,0x30,0x10,0xE0,//s
0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x60,//t
0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x78,//u
0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x20,//v
0x00,0x00,0x92,0x92,0xAA,0xAA,0x44,0x44,//w
0x00,0x00,0x88,0x50,0x20,0x20,0x50,0x88,//x
0x00,0x88,0x88,0x50,0x50,0x20,0x20,0x40,//y
0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,//z
0x18,0x20,0x20,0x20,0xC0,0x20,0x20,0x18,//{
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,//|
0xC0,0x20,0x20,0x20,0x18,0x20,0x20,0xC0,//}
0x00,0x00,0x00,0x62,0x92,0x8C,0x00,0x00//~
};
unsigned char array[32]={
0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,//8
0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,//0
0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,//5
0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,//1
};
//chuong trinh tao thoi gian tre//
void delay(unsigned int time)
{
unsigned int i=0;
while(i<time) i++;
}
//------------------------------//
//chuong trinh hien thi du lieu trang array ra ma tran//
//r la bit cho phep mau do, b la bit cho phep mau xanh
void send_ar(bit r_,bit b_)
{
char i=0,j=0,k=0,temp1=0;
unsigned char temp=0;
b_ena=b_;
r_ena=r_;
for(i=7;i>=0;i--)
{
temp1=~(1<<i);
for(j=3;j>=0;j--)
{
temp=array[i+j*8];
for(k=0;k<8;k++)
{
s_data=temp&1;
temp=temp>>1;
if(j==0)
{
position=temp1&1;
temp1=temp1>>1;
}
sh=0;
sh=1;
}
}
st=0;
st=1;
delay(2);
b_clr=0;
b_clr=1;
r_clr=0;
r_clr=1;
delay(1);
}
}
//------------------------------//
//chuong trinh dich du lieu qua trai//
void shift(unsigned int start)
{
unsigned int i=0;
for(i=0;i<32;i++)
{
array = font[1+start];
}
}
//------------------------------//
main()
{
unsigned char i=0,j=0;
P0=255;
P1=255;
P2=255;
P3=255;
while(1)
{
for(j=0;j<100;j++)
{
shift(j*8);
for(i=0;i<100;i++)
{
send_ar(0,0);
}
}
}
}