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.
i m using micro-controller p89v51rd2 in that i m trying program of keypad which out put show on 7 segment but in that when i m hold the key than out put will be show but after relished the key out put dont show or say my out put was not hold. so any one tell me how to hold my out put.
Isn't that obvious?
When you do detect a key - display it. When you do not detect a key - don't display.
The LCD will remember your last write request so if it overwrites the last key pressed it's because you are always sending out data to the display if or if not a key is pressed.
What "program" are you trying?
How do you expect anyone to comment on - let alone debug - your "program" without seeing it?!
"after released the key out put dont show"
What did you expect it to show?
"or say my out put was not hold"
Did you program it to do that?
If you didn't program it to do that, then it obviously won't do it!
If you did program it to do that, and it doesn't, then there is a bug in your program - so you need to debug it!
For tips on debugging, see: www.8052.com/.../120313
keypad code that i m using
#include <P89V51Rx2.H> sbit R1 = P2^0; sbit R2 = P2^1; sbit R3 = P2^2; sbit R4 = P2^3; sbit C1 = P2^4; sbit C2 = P2^5; sbit C3 = P2^6; sbit C4 = P2^7; sbit seg_a=P1^0; sbit seg_b=P1^1; sbit seg_c=P1^2; sbit seg_d=P1^3; sbit seg_e=P1^4; sbit seg_f=P1^5; sbit seg_g=P1^6; void main() { P2=0xf0; R4=1; R3=1; R2=1; R1=0; if (C1 == 0) { seg_a=1; seg_b=1; seg_c=1; seg_d=1; seg_e=1; seg_f=1; seg_g=0; } if (C2 == 0) { seg_a=0; seg_b=1; seg_c=1; seg_d=0; seg_e=0; seg_f=0; seg_g=0; } if (C3 == 0) { seg_a=1; seg_b=1; seg_c=0; seg_d=1; seg_e=1; seg_f=0; seg_g=1; } if (C4 == 0) { seg_a=1; seg_b=1; seg_c=1; seg_d=1; seg_e=0; seg_f=0; seg_g=1; } R4=1; R3=1; R1=1; R2=0; if (C1 == 0) { seg_a=0; seg_b=1; seg_c=1; seg_d=0; seg_e=0; seg_f=1; seg_g=1; } if (C2 == 0) { seg_a=1; seg_b=0; seg_c=1; seg_d=1; seg_e=0; seg_f=1; seg_g=1; } if (C3 == 0) { seg_a=1; seg_b=0; seg_c=1; seg_d=1; seg_e=1; seg_f=1; seg_g=1; } if (C4 == 0) { seg_a=1; seg_b=1; seg_c=1; seg_d=0; seg_e=0; seg_f=0; seg_g=0; } R4=1; R1=1; R2=1; R3=0; if (C1 == 0) { seg_a=1; seg_b=1; seg_c=1; seg_d=1; seg_e=1; seg_f=1; seg_g=1; } if (C2 == 0) { seg_a=1; seg_b=1; seg_c=1; seg_d=1; seg_e=0; seg_f=1; seg_g=1; } if (C3 == 0) { seg_a=1; seg_b=1; seg_c=1; seg_d=0; seg_e=1; seg_f=1; seg_g=1; } if (C4 == 0) { seg_a=0; seg_b=1; seg_c=1; seg_d=1; seg_e=1; seg_f=0; seg_g=1; } R1=1; R2=1; R3=1; R4=0; if (C1 == 0) { seg_a=1; seg_b=0; seg_c=0; seg_d=1; seg_e=1; seg_f=1; seg_g=0; } if (C2 == 0) { seg_a=0; seg_b=0; seg_c=1; seg_d=1; seg_e=1; seg_f=1; seg_g=1; } if (C3 == 0) { seg_a=1; seg_b=0; seg_c=0; seg_d=1; seg_e=1; seg_f=1; seg_g=1; } if (C4 == 0) { seg_a=1; seg_b=0; seg_c=0; seg_d=0; seg_e=1; seg_f=1; seg_g=1; } seg_a=0; seg_b=0; seg_c=0; seg_d=0; seg_e=0; seg_f=0; seg_g=0; }
sir i m using 7 segment not lcd so i want to hold data when another key was not press
Epic failure.
There is no loop in your program. It will run for a couple of microseconds and then end - what will it do then?
And have you really, really, really tried to run your tiny program once using pen and paper? Does it really decode an XY keyboard matrix?
For each combination of row lines driven, you get 4 bits (16 patterns) on the column lines. But your code is only testing one column at a time. What if two column bits are active?
Your processor allows you to control all row lines with one write, but you always make four bit writes.
And you always assumes that the column signals are stable and instantly available after you change the row signals.
Back to the drawing board. You have too many errors for expecting the forum to write your program for you. Your teacher is expecting _you_ to do this assignment.
Back to the drawing board. You have too many errors for expecting the forum to write your program for you. it would help YOU dramatically if you indented and COMMENTED your code. That it also would help someone willing to help you is a nice side effect.
Erik