We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
<main> #include<reg51.h> #include<delay.h> #include<temp.h> //#include<code.h> #include<counter.h> #define unsigned long int pdata cont[256] void main() { int tmp; counter(); while(1) { tmp=P0; compare(tmp);
}
<temp>
void temp(int x, int y) { int t; //tmp=P0;
for(t=0;t<320;t++) { P3=0x02; P1=x; delay(100); P3=0x01; P1=y; delay(100); }
<code>
#define A 0Xfc #define B 0X60 #define C 0Xda #define D 0Xf2 #define E 0X66 #define G 0Xb6 #define I 0Xbe #define J 0Xe0 #define K 0Xfe #define L 0Xf6 #define M 0X03 #define N 0X9f #define O 0X25 #define P 0X0d #define Q 0X99 #define R 0X49 #define S 0X41 #define T 0X1f #define U 0X01 #define V 0X19
<counter>
#define unsigned long int pdata cont[256]
int counter() { int z; //unsigned long int pdata cont[256]; for(z=255;z>0;z--) {cont[z]=z;} //return(0); }
<compare> #define unsigned long int pdata cont[256];
void compare(int k)
{
int l; for(l=255;l>=0;l--) {if(cont[l]==k) {temp(l,l);} } }
error is counter.h(8): error C202: 'cont': undefined identifier in counter.h
help me to remove this error.
this is a very complex problem. it required our whole support team to analyze the code and determine the cause.
this line is the cause of your problems.
try this instead
unsigned long int pdata cont[256];
note that the error message gave a VERY good clue! you must learn to read them and understand them.
Just a question: Why do you think #define is a good way to declare or define variables or data types? Have you seen such examples somewhere? Don't you think the C language in itself have proper constructs for the task?