Sorry, I think I miss understood your explanation in post #17 I thought you were talking about original keypad programming. that's the reason I posted only keypad program. I think you didn't notice my above post. I said my LCD is working and I have tested code. My main plan is to write program for calculator. I tried to write with matrix keypad but I couldn't get success. so I decide to replace keypad with switches. than Wbhan sir, suggested to me these thingsBefore you get into all of that, is your LCD working? Can you display characters and strings where you want them i.e. locate the cursor and write characters on both lines?
I ask because you went from a simple switch detect to several LCD versions and now to a keyboard scanner but the LCD code is gone.
It looks to me like you are jumping around without a plan. What is the plan? Despite your nice statement, I don't know what is better for you, only you know that. You asked about adding two numbers but your example of adding multiple digit numbers increased the complexity. In response, I suggested that you were moving into more complex coding and that was something to think about before proceeding. My suggestion that you need a keyboard scanner was something to think about as you kept adding things (the second operator).
As we have been telling you, you can't proceed without a plan. If you want to make a calculator, think about the main components and what they do:
.
So I followed there advice. I tested my program. when I press switch1, LCD display "1" and when I press switch LCD display "2'. so I think my hardware is fine. I need to learn programming. than in post #16 I explained what I want to doWrite a program that does nothing more than display a "1" on the screen.
Then change it so that it alternates between a "1" and a "2", changing once a second.
Then start worrying about tying what is displayed to reading switch inputs.
I wanted to make following in program
addition program
1) get the first argument, maybe multiple digits
2) get the operator '+'
3) get the second argument
4) get another operator '=' then perform the operation
I know very well I cant write complex program at this level so that's why I divided my task in to small parts. so If you see program. first my programming is working or not, than I wrote program to display number on LCD using switches. and than I tried to write to add tow numbersThat's a lot to do but note that the big task is split into smaller tasks - get keyboard input, display things. Note that the each big part is split into smaller parts. With a good design, you split things up then code and test each one separately. Once its working, move on to the next thing. That's why I asked about the LCD. If it's not working, get it working then leave it in your code and use it. Then on to the next step. and the next. When you are out of steps, you are done.
But even if you don't want the whole calculator, displays and keypads are common modules for many projects and its worth knowing how to do them.
That's the only way I know how to do it.
Now I have four switches, LCD and 8051 and I have to write working code for following condition
1) get the first argument, maybe multiple digits
2) get the operator '+'
3) get the second argument
4) get another operator '=' then perform the operation
I will try to add this features in my working program
I am not ignoring advice. I tried my best effort to make flow chart but every time I failed to make good flow chart. I feel making algorithm is more easy than drawing flow chart. but you suggested many times so I am making new flow chart. when it complete I will post that flow chart.You appear to be ignoring advice given before.
Draw a flow chart before you start coding. Design comes before coding. The flow chart must work on paper. The code must match the flow chart otherwise there is no point in drawing a flow chart.