sir, when i am doing 3d array initialization as following: unsigned char keypad[4][4][0] =('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); then its not showing any error. but when i use following line: unsigned char keypad[4][4][0] ={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; then compiler showing the error that there is some error near "{" so can you please resolve my problem....?
No, the compiler does not say that!
You need to post the full text of the message exactly as displayed; copy-&-paste it - do not manually re-type it.
Also, pay attention to the instructions for posting source code: www.danlhenry.com/.../keil_code.png
Why have a zero-size dimension? Please elaborate what your idea about this was. What is the allowed index range for a zero-size dimension?
#include<reg52.h> sfr lcddata=0x90; sbit rs=P3^2; sbit rw=P3^3; sbit en=P3^4; unsigned int i; unsigned char keypad0[4][4]; unsigned char keypad1[4][4]; unsigned char keypad2[4][4]; /*************************delay function*******************************************/ void delay(unsigned char b) { unsigned char a; for(i=0;i<b;i++) for (a=72;a>1;a--); } void delay2(unsigned int b) { unsigned int a,j; for(a=0;a<b;a++) for(j=0;j<120;j++); } /************************************Lcd initilization Command Function***********/ void command(unsigned char word) { en=1; rs=0; rw=0; delay(23); lcddata=word; en=0; } /******************************Display one word************************************/ void lcddisplay(unsigned word) { lcddata=word; en=1; rw=0; rs=1; delay(5); delay(5); en=0; } /***************************display lcd word second line***************************************/ void display(unsigned char *word) { int x; for(x=0;word[x]!=0;x++) { lcddisplay(word[x]); delay(5); } } /************************main function******************************************/ void main() { int k=1,i,l; unsigned char cloc, rloc; keypad0[4][4]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; keypad1[4][4]={'G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V'}; keypad2[4][4]={'W','X','Y','Z','!','@','#','*','%','^','&','(',')','?','/','.'}; command(0x38); command(0x0C); while(1) { command(0x01); do { P1 = 0x0f; cloc = P0; cloc = cloc & 0x0F; }while(cloc!=0x0F); do { do { delay2(20); cloc = P0; cloc = cloc & 0x0F; }while(cloc==0x0F); delay2(20); cloc = P0; cloc = cloc &0x0F; }while(cloc == 0x0f); while(1) { P0 = 0xEF; cloc = P0; cloc = cloc & 0x0f; if(cloc != 0x0F ) { rloc = 0; break; } P0 = 0xDF; cloc = P0; cloc = cloc & 0x0f; if(cloc != 0x0f) { rloc = 1; break; } P0 = 0xBF; cloc = P0; cloc = cloc & 0x0f; if(cloc != 0xf0) { rloc = 2; break; } P0 = 0x7F; cloc = P0; cloc = cloc & 0x0f; rloc = 3; } while(P0!=0x0f) { l = 0; if(l == 0) lcddisplay(keypad0[rloc][cloc]); if (l ==1) lcddisplay(keypad1[rloc][cloc]); if (l ==2) lcddisplay(keypad2[rloc][cloc]); delay2(1000); l = l+1; if (l>2) l=0; /*l++; if (l>2) { l=0; }*/ } //display("hello world"); /* command(0x8f); display("NARVEER and JAGDEEP"); for(k=0;k<32;k++) {command(0x1c); delay2(100); }*/ if(k==1) { /*if(k==1) { command(0x84); display("PM"); } else { command(0x84); display("AM"); }*/ for(i=5;i>=0;i--) { command(0x81); lcddisplay(0x30+k); command(0x82); lcddisplay(0x30+i); delay2(100); } k--; } delay2(100); if(k==0) { for(l=9;l>=0;l--) { delay2(100); command(0x81); lcddisplay(0x30); command(0x82); lcddisplay(0x30+l); delay2(100); } k++; } } } error C141
1) Now you suddenly don't have any three-dimensional arrays anymore with the innermost index having size zero.
2) Did you indent your code with tab (with seldom works when posting code on a web forum) or don't you intent your code at all?
3) Last line is "error C141". That is not a complete error message. A complete error message would also contain a descriptive text, a file name and a line number. And that line number should be marked in the full source code since we don't have any text editor letting us find a specific line without having to manually count.
4) Why do you attempt to assign a full set of array data to your matrix inside main(), and after the matrices was created? Do you really think that the operator "=" can assign multiple array indices in a single assign? You want to perform everything in the same step when creating the matrix. So something like:
const unsigned char keypad0[4][4] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
When you try to assign to an array at runtime, you have two options. Either you assign one entry at a time - which may involve a for loop for stepping through the index values. Or you perform a memcpy() to copy raw data from another array of compatible element type (but potentially with different number of dimensions and size of the individual dimensions).
"there is some error near "{""
this reminds the phrase of "help us help you".
it is always pity to see someone falls to that kind of levels.
it is always pity to see someone falls to that kind of levels
Whoever you are hiding under the homewreckers name:
I am truly impressed that you can help someone who states "I have an error" without him helping you helping him.
Erik
"I am truly impressed that you can help someone who states "I have an error" without him helping you helping him."
you are truly impressed because you don't understand this conversation.
if this does not mean: "those that do not help without asking for complete information have fallen to a low level" Then I strongly suggest you check your english verbiage.
[this reminds the phrase of "help us help you".
Erik]
if this does mean: "those that do not help without asking for complete information have fallen to a low level" Then I strongly suggest you check your english verbiage.
A verbiage clarification request answered with an IF? keep forever blowing bubbles
BTW it is customary to put quotes in italics
"BTW it is customary to put quotes in italics"
keep forever blowing bubbles
A verbiage clarification request answered with an IF?
get a post without a response to the question.
so, homewrecker, ANSWER THE QUESTION and please give a link to a post, just one, where you have actually helped the OP rather than criticising other posts.
if you can't do the above two, SHUT UP!!
"ANSWER THE QUESTION"
love to help you out there if you could ever answer the question why T0's maximum clock rate has anything to do with T1's counting pulses.
eveidently you are unable to to either
PS circumventing a question seems a favorite tactic of yours
"f you can't do the above two, SHUT UP!!
Erik"
so, erik, why is T0's maximum clock rate has anything to do with T1's counting pulses again?