các anh ơi có cái chương trình này mà em làm nó không chịu chạy có pro nào giúp em với nó báo lỗi
CODEMAYTINH.C(76): error C141: syntax error near '[', expected '='
.
file mô phỏng proteus 7.4 nữa đây ạ
#include<reg51.h>
#include<string.h>
#include<math.h>
#include<intrins.h>
#include<stdlib.h>
#include<stdio.h>
sbit RS=P1^0;
sbit RW=P1^1;
sbit EN=P1^2;
sbit hang0=P0^4;
sbit hang1=P0^5;
sbit hang2=P0^6;
sbit hang3=P0^7;
char str;
void delay(unsigned long int n)
{
int i;
for(i=0;i<n;i++);
}
void delay30ms(void)
{
TMOD=0x10;
TH1=35535/256;
TL1=35535%256;
TR1=1;
while(!TF1);
TR1=TF1=0;
}
void delay10ms(void)
{
TMOD=0x01;
TH0=55535/256;
TL0=55535%256;
TR0=1;
while(!TF0);
TR0=TF0=1;
}
void write_command (unsigned char LCD_command)
{
delay10ms();
P2=LCD_command;
RS=0;
RW=0;
EN=1;
delay(50);
EN=0;
delay(50);
}
void write_data (unsigned char LCD_data)
{
delay10ms();
P2=LCD_data;
RS=1;
RW=0;
EN=1;
delay(50);
EN=0;
delay(50);
}
void write_string(char*s)
{
while(*s)
{
write_data(*s);
s++;
}
}
void init(void)
{
write_command(0x03);
write_command(0x38);
write_command(0x06);
write_command(0x0e);
}
unsigned char i,j,x;
sbit m_hang[];
void main(void)
{
init();
while(1)
{
m_hang[0]=hang0;
m_hang[1]=hang1;
m_hang[2]=hang0;
m_hang[3]=hang3;
write_command(0x01);
write_command(0x80);
write_string(" phim so: ");
x=0xFE;
for(i=0;i<=3;++i)
{
p0=x;
x=_crol_(x,1);
for(j=0;j<=3;++j)
{
if(m_hang[j]==0)
itoa(j*4+i,&str);
write_string(&str);
}
}
}
}
CODEMAYTINH.C(76): error C141: syntax error near '[', expected '='
.
file mô phỏng proteus 7.4 nữa đây ạ
#include<reg51.h>
#include<string.h>
#include<math.h>
#include<intrins.h>
#include<stdlib.h>
#include<stdio.h>
sbit RS=P1^0;
sbit RW=P1^1;
sbit EN=P1^2;
sbit hang0=P0^4;
sbit hang1=P0^5;
sbit hang2=P0^6;
sbit hang3=P0^7;
char str;
void delay(unsigned long int n)
{
int i;
for(i=0;i<n;i++);
}
void delay30ms(void)
{
TMOD=0x10;
TH1=35535/256;
TL1=35535%256;
TR1=1;
while(!TF1);
TR1=TF1=0;
}
void delay10ms(void)
{
TMOD=0x01;
TH0=55535/256;
TL0=55535%256;
TR0=1;
while(!TF0);
TR0=TF0=1;
}
void write_command (unsigned char LCD_command)
{
delay10ms();
P2=LCD_command;
RS=0;
RW=0;
EN=1;
delay(50);
EN=0;
delay(50);
}
void write_data (unsigned char LCD_data)
{
delay10ms();
P2=LCD_data;
RS=1;
RW=0;
EN=1;
delay(50);
EN=0;
delay(50);
}
void write_string(char*s)
{
while(*s)
{
write_data(*s);
s++;
}
}
void init(void)
{
write_command(0x03);
write_command(0x38);
write_command(0x06);
write_command(0x0e);
}
unsigned char i,j,x;
sbit m_hang[];
void main(void)
{
init();
while(1)
{
m_hang[0]=hang0;
m_hang[1]=hang1;
m_hang[2]=hang0;
m_hang[3]=hang3;
write_command(0x01);
write_command(0x80);
write_string(" phim so: ");
x=0xFE;
for(i=0;i<=3;++i)
{
p0=x;
x=_crol_(x,1);
for(j=0;j<=3;++j)
{
if(m_hang[j]==0)
itoa(j*4+i,&str);
write_string(&str);
}
}
}
}
Comment