1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

reading a 4x4 switch matrix

Discussion in 'Microcontrollers' started by MrDEB, Mar 5, 2018.

  1. tumbleweed

    tumbleweed Active Member

    Joined:
    Jan 25, 2007
    Messages:
    137
    Likes:
    37
    With a little optimization here and there I got the SwordfishSE version down to 1477 program bytes and 71 variable bytes.
    Swordfish reserves 24 bytes for its internal use, so if you account for that it reduces the variable usage down to 71-24=47 bytes.

    That includes the LCD_WriteString() routine.
     
  2. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,281
    Likes:
    159
    Location:
    morristown,tn
    They removed all the libraries I got tons of code and the dam libraries are gone
     
  3. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,745
    Likes:
    162
    Location:
    Seattle, WA
    Out of curiosity MrDEB, how much do you sell your games for?
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  5. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,853
    Likes:
    961
    Location:
    Rochdale UK
  6. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,281
    Likes:
    159
    Location:
    morristown,tn
    That's the 18 f libs I got a book years ago it use the one for 12f and 16 f chips I lost my hard drive . I kind give up on it now learning xc8 and write it all from beginning. problem i have now is I don't think right like I once did. LOL
     
  7. large_ghostman

    large_ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    4,725
    Likes:
    532
    Location:
    SCOTLAND
    Burt hate to tell you this mate but........... I think its just a case of you only just noticed :p, standing here i dont see no change :joyful:.

    Mr Deb.
    We will forget you ever suggested I would waste 4 hours of my life playing a game when i could be in the lab or workshop!

    So forgive me for asking, and i apologize to everyone in advance for bringing this up, but why not give everyone a key pad? and link to one calculator? display the results on a small screen instead of a LCD. We wont go the blue tooth route, but you could even use rs232 to display the results on a tiny monitor.

    If you used two ADC Pins for the first keypad, then one of the pins used has a fixed resistor going to VDD , that way you get effectively a voltage divider.
    So lets say the keypad has 4 row pins and 4 column pins, at the end of each of these pins you put a resistor of different value. Read the second ADC pin and the voltage tells you what key was pressed, each keypad then only use a different ADC channel to tell you which play pressed which key.....

    I think my explanation is going to need a schematic isnt it...
     
    • Like Like x 1
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  9. MrDEB

    MrDEB Well-Known Member

    Joined:
    Apr 16, 2007
    Messages:
    4,618
    Likes:
    25
    I want to make this as simple and cost effective as possible.
    As for the game hubs, I have sold the present version for $20 each. The switches are what kills the price. The lighted switches cost $1.80 each thus the new version uses a simple tactile switch and 1206 led thus lowering the price significantly. The other issue's are the location of the battery enclosure and needing an enclosure so when a switch is pressed the board does not tip with the battery mounted on the bottom. The newer version has corrected all present issues.
     
  10. MrDEB

    MrDEB Well-Known Member

    Joined:
    Apr 16, 2007
    Messages:
    4,618
    Likes:
    25
    here is the shipment on its way. This is the two game version
     

    Attached Files:

  11. MrDEB

    MrDEB Well-Known Member

    Joined:
    Apr 16, 2007
    Messages:
    4,618
    Likes:
    25
    back to the 4 x 4 matrix. Looking at what I have on the schematic and only needing 8 pins for switch matrix, 6 for the LCD 2 pins for Vdd and grd maybe look at using an 18 or 28 pin pic.
    Ordered 5 LCDs from China so need to stick with 5v chip, no K's allowed. Memory needed is to be determined after I get my code done and tested.
     
  12. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,745
    Likes:
    162
    Location:
    Seattle, WA
    Oh. I suppose you are just covering your costs then. Considering the inordinate amount of help people give you on all of your projects, those people helping you might feel a bit used and abused if you were profiting because of their efforts.
     
  13. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,745
    Likes:
    162
    Location:
    Seattle, WA
    You need to check your facts Jack. The POS 18F25k20 is one of the few k series that's limited to 3.3 volts.
     
  14. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,853
    Likes:
    961
    Location:
    Rochdale UK
    Funny though... I ran mine for 3 months before I noticed it was a 3.3v device... It ran at 5v just fine... I swapped to the K22 which was 5v..
     
  15. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,745
    Likes:
    162
    Location:
    Seattle, WA
    When Amicus (Proton Basic?) came out in the free version supporting only the 18F25k20, there was a huge amount of criticism. I think eventually they added the K22, but that was a year or more after it came out.

    That was a very strange group of people - the members of the forum, even for the open, free Amicus version, were very suspicious and distrusting. A friend gave me a Proton dev board, and when I asked in the forum if a schematic was available, the response was hostile. If I had the board "legitimately", I would have a schematic, so obviously, I was lying to get a schematic so I could steal the design. When my remarks didn't conform to the party line, my account and every message I had ever posted disappeared. When challenged on it the response was "That didn't happen, or if it did, somebody made a mistake." That left a lot of forum threads of somebody asking a question, with the next message being "Thanks. That's exactly what I needed to do." ;)
     
  16. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,711
    Likes:
    129
    Location:
    Michigan, USA
    I hesitate to suggest this but someone with much more patience than me might be able to help you multiplex four of the keypad matrix lines with four of the LCD lines.

    Cheerful regards, Mike

    muxed.png
     
    Last edited: Mar 15, 2018
  17. Dan Soze

    Dan Soze Member

    Joined:
    Dec 21, 2017
    Messages:
    40
    Likes:
    19
    Something like this:
    [​IMG]
     
  18. large_ghostman

    large_ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    4,725
    Likes:
    532
    Location:
    SCOTLAND
    I have deleted my post.

    I had no idea you had been selling the things you made, it makes sense now why you moan about 28p for a crystal. i thought maybe you were just really broke, i didnt realize you were thinking of your profit margin......

    Every time i reply in this post it turns into a rant and i delete!! So all i am going to say is.

    Make sure you put a big thank you on those boards to Jonsea etal without whom you would be selling dead bits of black plastic that take a car battery to power up.
     
    • Like Like x 1
  19. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,745
    Likes:
    162
    Location:
    Seattle, WA
    28 pence counts if you're making hundreds of them; if you're making 10, it's not so important. And the cost has to be weighed again all the forum pages when it doesn't work because something was set up wrong!


    Regarding multiple LCD displays, a number of displays can be connected in parallel with separate pins driving the E(nable) pin of each display. But I think maybe MrDEB intends the calculators to be stand alone? Explaining what he's trying to do has never been a strong point!

    Related to sharing the LCDs, years ago I connected 2 parallel printers to a single interface. If either printer was switched on, it worked great - totally transparent to operation. But if I forgot and switched both printers on, they were very polite and worked together. One would print a line, and the other the next line!
     
  20. large_ghostman

    large_ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    4,725
    Likes:
    532
    Location:
    SCOTLAND
    Tree KILLER! :troll::woot:
     
  21. MrDEB

    MrDEB Well-Known Member

    Joined:
    Apr 16, 2007
    Messages:
    4,618
    Likes:
    25
    I am not making a profit but more at a loss. I am enjoying learning different aspects of programming a pic. No schooling, and very little electronics schooling as well. Have always been interested in electronics, had one year in high school but we are talking 1968, way before microcontollers came out.. its all from the input I get from the web.
    As for thanks, I have thanked every time I can.
     
  22. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,281
    Likes:
    159
    Location:
    morristown,tn
    I still say they hand pick the low voltage chips and a pic is a hard chip to break I forgot and powered a 16f505 at 12 volts it still runs and you could of made eggs on it before I unplugged It.

    I'll go one more I got one of the first pic 32 it was 3.3 volt I thought I killed it with my pickit2 I forgot to set for 3.3 volts that was a no no for the chip.
    I found it a week ago and put it in my microstick 2 it works fine.

    There way more forgiving then some avr's I've used they die very fast.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice