EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home

chandrasekhar

  • Profile
  • Topics Started
  • Replies Created
  • Engagements

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 21 total)
1 2 →
  • Author
    Posts
  • September 12, 2014 at 7:19 am in reply to: interface #12156
    chandrasekhar
    Participant

    The subroutine check_keypad can be used to directly interface any 4X3 matrix keypad. It checks if any switch on the matrix keypad is pressed. If any of the switch is pressed then the switch is debounced and we wait until the switch has been released. Once the switch has been released the switch number is loaded into the accumulator and the carry flag is set to indicate that a switch has been pressed. If NO switch has been pressed then the accumulator is cleared and the carry flag is also cleared to indicate no switch has been pressed.

     

    column1 bit P1.0
    column2 bit P1.1
    column3 bit P1.2
         
    row1 bit P1.3
    row2 bit P1.4
    row3 bit P1.5
         
    row4 bit P1.6

    check_keypad:

     

    clr column1

     
    setb column2 ;Select Column 1
    setb column3  
       

    jnb row1,c1_check_keypad

    jnb row2,c2_check_keypad

    jnb row3,c3_check_keypad

    jnb row4,c4_check_keypad

     
       
    setb column1  
    clr column2 ;Select Column 2
    setb column3  
       

    jnb row1,c5_check_keypad

    jnb row2,c6_check_keypad

    jnb row3,c7_check_keypad

    jnb row4,c8_check_keypad

     
     
    setb column1  
    setb column2 ;Select Column 3
    clr column3  
       
    jnb row1,c9_check_keypad

    jnb row2,c10_check_keypad

    jnb row3,c11_check_keypad

    jnb row4,c12_check_keypad

     
     

    setb column1

    setb column2

    setb column3

     
     
    mov a,#00h ;Since no switch has been pressed so Acc=00h
    clr c ;and C=0
    ret  
       
    c1_check_keypad: //column 1, row 1
    mov r7,#00h  
       

    deb1_check_keypad:

    ;debounce row 1 switch
    jb row1,r1_check_keypad

    djnz r7,deb1_check_keypad

     
       
    jnb row1,$ ;wait till switch is released
    mov a,#1 ;since switch pressed is 1, Acc =1
    setb c ;Indicating switch has been pressed
    setb column1  
    ret  
       

    r1_check_keypad:

     
    setb column1 ;Error while debouncing so return
    mov a,#0

    clr c

    ret

     
     
    c2_check_keypad: //column 1, row2
    mov r7,#00h  
       
    deb2_check_keypad: ;debounce row 2 switch

    jb row2,r2_check_keypad

    djnz r7,deb2_check_keypad

     
       
    jnb row2,$ ;wait till switch is released
    mov a,#4 ;since switch pressed is 4, Acc =4
    setb c ;Indicating switch has been pressed
    setb column1  
    ret  
       

    r2_check_keypad:

     

    setb column1

    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

     
       
    c3_check_keypad: //column 1, row3
    mov r7,#00h  

     

     
    deb3_check_keypad: ;debounce row 3 switch

    jb row3,r3_check_keypad

    djnz r7,deb3_check_keypad

     

    jnb row3,$                                                     ;wait till switch is released

    mov a,#7                                                      ;since switch pressed is 7, Acc =7

    setb c                                                            ;Indicating switch has been pressed

    setb column1

    ret

     

    r3_check_keypad:

    setb column1                                             ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c4_check_keypad:                                             //column 1, row4

    mov r7,#00h

     

    deb4_check_keypad:                                       ;debounce row 4 switch

    jb row4,r4_check_keypad

    djnz r7,deb4_check_keypad

    jnb row4,$                                                ;wait till switch is released

    mov a,#10                                               ;since switch pressed is 10, Acc =10

    setb c                                                       ;Indicating switch has been pressed

    setb column1

    ret

     

    r4_check_keypad:

    setb column1                                       ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c5_check_keypad:                                            //column 2, row 1

    mov r7,#00h

     

    deb5_check_keypad:                                        ;debounce row 1 switch

    jb row1,r5_check_keypad

    djnz r7,deb5_check_keypad

    jnb row1,$                                                 ;wait till switch is released

    mov a,#2                                                  ;since switch pressed is 2, Acc =2

    setb c                                                        ;Indicating switch has been pressed

    setb column2

    ret

     

    r5_check_keypad:

    setb column2                                          ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c6_check_keypad:                                          //column 2, row2

    mov r7,#00h

     

    deb6_check_keypad:                                    ;debounce row 2 switch

    jb row2,r6_check_keypad

    djnz r7,deb6_check_keypad

    jnb row2,$                                            ;wait till switch is released

    mov a,#5                                             ;since switch pressed is 5, Acc =5

    setb c                                                   ;Indicating switch has been pressed

    setb column2

    ret

     

    r6_check_keypad:

    setb column2                                   ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c7_check_keypad:                                   //column 2, row3

    mov r7,#00h

     

    deb7_check_keypad:                              ;debounce row 3 switch

    jb row3,r7_check_keypad

    djnz r7,deb7_check_keypad

    jnb row3,$                                          ;wait till switch is released

    mov a,#8                                           ;since switch pressed is 8, Acc =8

    setb c                                                 ;Indicating switch has been pressed

    setb column2

    ret

     

    r7_check_keypad:

    setb column2                                    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c8_check_keypad:                                     //column 2, row4

    mov r7,#00h

     

    deb8_check_keypad:                                ;debounce row 4 switch

    jb row4,r8_check_keypad

    djnz r7,deb4_check_keypad

    jnb row4,$                                          ;wait till switch is released

    mov a,#11                                         ;since switch pressed is 11, Acc =11

    setb c                                                 ;Indicating switch has been pressed

    setb column2

    ret

     

    r8_check_keypad:

    setb column2                                    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c9_check_keypad:                                    //column 3, row 1

    mov r7,#00h

     

    deb9_check_keypad:                              ;debounce row 1 switch

    jb row1,r9_check_keypad

    djnz r7,deb9_check_keypad

    jnb row1,$                                         ;wait till switch is released

    mov a,#3                                           ;since switch pressed is 3, Acc =3

    setb c                                                 ;Indicating switch has been pressed

    setb column3

    ret

     

    r9_check_keypad:

    setb column3                                    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c10_check_keypad:                                   //column 3, row2

    mov r7,#00h

     

    deb10_check_keypad:                             ;debounce row 2 switch

    jb row2,r10_check_keypad

    djnz r7,deb10_check_keypad

    jnb row2,$                                          ;wait till switch is released

    mov a,#6                                           ;since switch pressed is 6, Acc =6

    setb c                                                 ;Indicating switch has been pressed

    setb column3

    ret

     

    r10_check_keypad:

    setb column3                                    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c11_check_keypad:                                   //column 3, row3

    mov r7,#00h

     

    deb11_check_keypad:                              ;debounce row 3 switch

    jb row3,r11_check_keypad

    djnz r7,deb11_check_keypad

    jnb row3,$                                          ;wait till switch is released

    mov a,#9                                           ;since switch pressed is 9, Acc =9

    setb c                                                 ;Indicating switch has been pressed

    setb column3

    ret

     

    r11_check_keypad:

    setb column3                                    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

    c12_check_keypad:                                 //column 3, row4

    mov r7,#00h

     

    deb12_check_keypad:                           ;debounce row 4 switch

    jb row4,r12_check_keypad

    djnz r7,deb12_check_keypad

    jnb row4,$                                          ;wait till switch is released

    mov a,#12                                         ;since switch pressed is 12, Acc =12

    setb c                                                 ;Indicating switch has been pressed

    setb column3

    ret

     

    r12_check_keypad:

    setb column3                                    ;Error while debouncing so return

    mov a,#0

    clr c

    ret

     

    September 12, 2014 at 7:08 am in reply to: 8051 project #12155
    chandrasekhar
    Participant

    check the code,may the data is latching on the lcd.

    March 26, 2013 at 5:05 pm in reply to: rfid based security system code of c programming using the id given #9376
    chandrasekhar
    Participant

    what u have specified is not the tag serial code.inorder to find the serial code.u have to interface your rfid module with pc then u can see the 12 bit serial code in the hyperterminal.

    March 26, 2013 at 4:38 pm in reply to: RFID interfacing #9375
    chandrasekhar
    Participant

    you need to interface another max-232 to your microcontroller.then you can connect the max232 of rfid reader to the max 232 of microcontroller.

    March 26, 2013 at 4:35 pm in reply to: Intefacing Problem in my RFID module and its CODING….. #9374
    chandrasekhar
    Participant

    you need to interface another max-232 to your microcontroller

    September 13, 2012 at 6:51 pm in reply to: problem for downloading the code in to microcontroller #8584
    chandrasekhar
    Participant

    PLEASE SEND AVAILABLE INFORMATION TO MY EMAIL:  [email protected]

    September 13, 2012 at 6:49 pm in reply to: problem for downloading the code in to microcontroller #8583
    chandrasekhar
    Participant

    89V51RD2 MICROCONTROLLER

    September 12, 2012 at 6:49 pm in reply to: problem with 16X2 LCD #8569
    chandrasekhar
    Participant

    thank you sir

    iam using port2 for lcd data pins.where i have to change these port pin values

    September 12, 2012 at 6:48 pm in reply to: problem with 16X2 LCD #8579
    chandrasekhar
    Participant

    thank you sir.

    so i need to change in code is it right

    September 12, 2012 at 1:56 am in reply to: problem with 16X2 LCD #8570
    chandrasekhar
    Participant

    my mc is 89v51RD2.PORT2 (21-28) IS BIDIRECTIONAL I/O PORT WITH INTERNAL PULLUP’S.

    MY PULL UP RESISTOR SPECIFICATION IS A103J.

    September 9, 2012 at 5:25 pm in reply to: problem with 16X2 LCD #8557
    chandrasekhar
    Participant

     

    only lcd 12th pin is showing voltage level high and remaining data pins are showing low.
    the pull up resistor(8 pins) connected to these data lines is showing low and pull up resistor 9th pin which is connected to vcc is high.
    we used 3 pull up resistors 
    1.at port 1 used for 7 switches (here all the 9 pins of pull up resistor is showing high)
    2.at port2 used for data pins of lcd(only 9thpin showing high remaining pins is showing low)
    3.at port 0 used for control pins (here all the 9 pins of pull up resistor is showing high)
    please any one help where is the problem
    September 9, 2012 at 3:03 pm in reply to: problem with 16X2 LCD #8556
    chandrasekhar
    Participant

    i have another problem with downloading the code in to mc through serial port

     

    when switch on the power supply.then terminal shows the o/p all the 4 cases i.e
    1.db9 connector 2&3 pins short
    2.max-232 13 &14 pins short.
    3.max-232 11&12 pins short.
    4.microcontroller 10&11 pins short.
     
    but when i tried to download the code in to the mc.
     
    it is showing reset the device in to isp mode now .
     
    even though after pressing the reset switch also.
    please anyone help where is the problem
    September 9, 2012 at 2:58 pm in reply to: problem with 16X2 LCD #8555
    chandrasekhar
    Participant

    please send the complete code of lcd based electronic voting machine

    my email:[email protected]

    September 9, 2012 at 8:13 am in reply to: problem with 16X2 LCD #8553
    chandrasekhar
    Participant

    my projct is “lcd based electronic voting machine”

    September 9, 2012 at 8:12 am in reply to: problem with 16X2 LCD #8552
    chandrasekhar
    Participant

     

    A103J PULL UP RESISTOR

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 21 total)
1 2 →

RSS Recent Posts

  • Fun with AI and swordfish basic July 19, 2025
  • using a RTC in SF basic July 19, 2025
  • Does US electric code allow branching ? July 19, 2025
  • Faulty heat air gun (dc motor) - problem to locate fault due to Intermittent fault July 19, 2025
  • Sump pit water alarm - Kicad 9 July 19, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise