here is a simple program for lcd .I get an error c141 while accessing port.Can anyone help me rectifying it.
#include<reg51.h> #define data=P2; sbit en=P1^0; sbit rs=P1^1; sbit rw=P1^2; void delay() { int i,j; for (i=0;i<1000;++i) for(j=0;j<1085;j++); }
void main() { int k; char a; char *n="Revaapriyan"; for(k=0;n[k]!="\0";k++) { a=n[k]; rs=1; rw=0; en=1; data = a; //"clcd.c(24): error C141: syntax error near '=' " delay(); en=0; } }
The problem is here:
#define data=P2;
What you meant to say is this:
#define data P2
Even with having that corrected, it remains problematic. "data" is a keyword used by the compiler, see: http://www.keil.com/support/man/docs/c51/c51_le_keywords.htm
Do NOT misuse these keywords!