Discussion in "8051 Discussion Forum" started by    Luqman    Nov 30, 2007.
Fri Nov 30 2007, 04:55 pm
#1
hi, Ajay plz make me understand this section of code.
 unsigned char get_key(){
        unsigned char i,k,key=0;
        k=1;
        for(i=0;i<4;i++){
                keyport &=~(0x80>
>
i);
                        if(!col1){
                                key = k+0;
                                while(!col1);
                                return key;
                        }
                        if(!col2){
                                key = k+1;
                                while(!col2);
                                return key;
                        }
                        if(!col3){
                                key = k+2;
                                while(!col3);
                                return key;
                        }
                        if(!col4){
                                key = k+3;
                                while(!col4);
                                return key;
                        }
                k+=4;
                keyport |= 0x80>
>
i;
        }
        return FALSE; 
}
 


Fri Nov 30 2007, 06:49 pm
#2
I will put comments on the tutorial do not worry..
Everything is same as i did in AVR program. Please wait till tonight so that i can update the tutorial with comments. If you are in hurry then look at the AVR program, everything is same as this.
Sat Dec 01 2007, 11:21 pm
#3

hi, Ajay. I visited but not updated yet. plz update it i m waiting.
Sat Dec 01 2007, 11:23 pm
#4
oww.. i am so sorry.. was busy i will update in a min!
 Luqman like this.
Sun Dec 02 2007, 12:41 am
#5
I have updated the tutorial you may check now
Sun Dec 02 2007, 01:36 pm
#6
Well Ajay, how will i call these keypad routines in assembly and C functions from main program. Plz give me idea in Assebly and C as well.
Sun Dec 02 2007, 05:55 pm
#7
for assembly.. just type

acall get_key     ;to get the value of key
;it will be stored in keyval variable...


similarly in case of C you can use it as..
key = get_key();
//key number will be returned and assigned to variable key

 HiteshDR like this.
Sat Dec 22 2007, 05:38 am
#8
sorry i couldnt understand how to program with assembler
can you give more information?
thanks a lot
Sat Dec 22 2007, 02:39 pm
#9
check tutorial page.. i have given code for assembly too.. ask me if you feel any problem

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm