--- This is a test - only visible to admins ---
--- advertisement may go here ---
  • Pic® Basic

  • Graphic LCD Address Lines as Button inputs

    The above circuit uses a PIC® 16F877 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 GLCD_KEY.BAS

    How it works

    The connection of the GLCD 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 eight 10k resistors hold the address lines high and the 100R resistors are to limit the current in case of errors (i.e. two pins passing 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). Make variable KEY=0.

    2, Make RD4 an input, check if the button is pressed (value=0) or not 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 it as an “include” file.

    I hope you find this useful.

    73 de Mark Rodgers G0EBB.

    Download glcd_key.bas here
  • Recent Activity


    Frequency counter

    Thread Starter: teo

    Hello everybody Can someone help me with a piece of code to measure a frequency (1Hz to 160 Hz) precision two decimals. The result is transmitted...

    teo Yesterday, 17:43 Go to last post

    SD routines for 18F series

    Thread Starter: charliecoultas

    I've used the SD routines very successfully for the P24 chips, but now I need to attach an SD card to a 18F26K22. Do such routines exist and if...

    RGV250 Yesterday, 19:40 Go to last post

    PickitPlus for Pickit2 and Pickit3 works well

    Thread Starter: leonj

    Hi Everyone, I have always had issues with Pickit2/Pickit3 and I'm glad to say they seem to all be solved now. I obtained PickitPlus from Even at...

    towlerg Yesterday, 14:36 Go to last post