• Pic® Basic


  • Using a 2 x 16 LCD Address Lines as Button Inputs

    Mark Rodgers G0EBB 20,01,03


    The above circuit uses a PIC16F877 but it will work with any PIC® you choose, the file that supports the hardware will need to be changed to suit the pins chosen for the address lines you use on your PIC®.
    This diagram must be used with LCD_KEY.BAS.

    How it works

    The connection of the LCD is as standard and this circuit and software can be very easily used in any existing project or new one. The buttons do not interfere with the operation of the display in any way.

    The four 10k resistors hold the address lines high and the 1k resistors are to limit the current in case of errors (i.e. two pins trying to pass current through the switch).
    The buttons could easily be any external signal that is normally open and does not carry any power of its own.

    The software is very simple and works as follows;

    1, Make RC1 (common line of switch) to an output and clear it (connect to 0 volts)
    2, Make RD4 an input, check if the button has been pressed (value=0) or if it has not been pressed (value=1), if pressed then give the variable KEY a value (1,2,3 or 4 etc).
    3, Repeat 2, above with RD5 etc.
    4, Make RC1 (common line of switch) an input and continue with the rest of your code.

    The use of control line RC1 is to stop a button press corrupting the display if it is pressed when the display is being sent data. I have never seen any corruption of the display using this system and it has proved 100% reliable.

    I use the software as a subroutine and call it just before I need a key input with the line “GOSUB button_check” and generally use the subroutine as an “include” file.

    I hope you find this useful.

    73 de Mark Rodgers G0EBB.

    Download the code HERE
  • Recent Activity

    John Drew-26

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    John Drew Yesterday, 08:55 Go to last post
    John Lawton-121

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    John Lawton Yesterday, 11:32 Go to last post
    John Drew-26

    IR Sensor Codes in Proton IDE

    Thread Starter: Mesgu

    Hello guys can someone help me plsssss... How to write a codes for IR sensor in proton ide? given: Transmitter = portb.1 Receiver = portb.0 Led...

    John Drew Today, 03:12 Go to last post
    picprotonguy-1827

    working weird

    Thread Starter: rverm

    Device = 18F2220 Xtal 4 TRISA = 111 TRISB = 0 TRISC = 0 Declare CCP1_Pin PORTC.2 ' Select Hpwm port and bit for CCP1 module. 'Declare CCP2_Pin...

    picprotonguy Yesterday, 08:03 Go to last post
    mhanley-1294

    18F47J13 or 18F47J53 Definition Files

    Thread Starter: mhanley

    Hi, I want to use either the 18F47J13 or 18F47J53 but Proton does not have a definition file for either micro. I need the extra program...

    mhanley Yesterday, 09:57 Go to last post