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

input and save input

Discussion in 'Microcontrollers' started by MrDEB, Nov 7, 2017.

  1. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    There's a first time for everything....

    Personally, I'd use a port expander or LED driver chip than trying to solder TQFP with an iron.
     
  2. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,391
    Likes:
    22
    the project could use 10 players, battery powered, 17-20
    leds
    looking at the 18f44K20, 25K22 & 26K22
    I have a board layout but it was only 1 game option. This new project is a combination of Mexican Train and a fast version of Mexican train I call Bullet Train.
    With the 2 games I need more pins since the 1 game option uses a 18f2221 with no issues (a 28 pin pic)
     
  3. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,080
    Likes:
    326
    Location:
    Brisbane Australia
    Arrange your LEDs in a 4 by 5 matrix and your keyboard in a 2 by 5 therefore only needing 11 pins for all keys and LEDs.

    Mike.
     
    • Like Like x 2
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,391
    Likes:
    22

    I apprciate your input Jon. Have viewed several videos using a soldering iron and lots of flux. Since I started using Chip-Quik flux for soldering a SOIC pic, I am able to solder each pic in under 90 seconds with no solder issues.
    Trying not to add more chips as the cost increases. I got lucky that I found lighted LED mom switches but at $2 each, decided to go with small tactical push-button similar to the ones on the Tap 28. In fact that's where I got the idea to use a small cheap tactical switch.
     
  6. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,391
    Likes:
    22
    A 4 x 5 matrix sounds like a solution. Will research for sure.
    Thanks for the idea.
     
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,827
    Likes:
    138
    Location:
    morristown,tn
    Good luck with the K chips it's like jon said swordfish has bugs with them you'll have a hard time figuring out what the heck is wrong.
     
  8. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,391
    Likes:
    22
    I did a search on the microchip site and the parametric search came up empty, only K series. I want to stay away from the K series but have used them in a project with success but not without programming issues.
    Doing more searching for a better choice and hopefully not a K series. The voltage range is enticing and may have to go with a K series.
     
  9. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,080
    Likes:
    326
    Location:
    Brisbane Australia
    What is wrong with a 18F2620 or 4620?

    Mike.
     
  10. tumbleweed

    tumbleweed Member

    Joined:
    Jan 25, 2007
    Messages:
    58
    Likes:
    15
    Before someone gets the wrong idea, I use swordfish with the 18F K and J series parts with no issues.

    The problem is with the libraries. Many of them are written for the older parts and haven't been updated. Since libraries in swordfish are source code you just have to modify them to support your newer part.

    Almost every new part Microchip does changes something. Even they quit trying to keep their libraries up to date and now force you to use their MCC code generator (which doesn't support many parts at all).

    Same goes for the programmers. The pickit2/pickit3 standalone apps haven't been updated in years, so if you use a "new" part you may have issues there too. You might have to switch to the mplabx IPE/command line drivers which brings in a whole new set of problems.
     
  11. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    Good point about the K-series chips and Swordfish. As I said above my "go to" chips are the 18F25K22 and 18F26K22 where I need more memory.

    Swordfish is unique that the libraries are written in Swordfish. common problems with newer chips is that a register name jas changed or the pinout for a hardware function has moved. These type of problems Re usually not too difficult to resolve with some assostance from t&e dats sheet.

    MrDEB's; infamous troibleshooting skills, where the syntax of an improperly formatted if/then can take 4 pages, make him a good candidate for the traditional parts.
     
  12. tumbleweed

    tumbleweed Member

    Joined:
    Jan 25, 2007
    Messages:
    58
    Likes:
    15
    You really think that'll help?

    I'd be happy if he'd stop writing to input ports.
     
  13. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,242
    Likes:
    911
    Location:
    Rochdale UK
    Just a note!! If you do get K series.... The pic18f45k20 is a low voltage chip only( 3.3v)... The pic18f45k22 is 5v ... I got caught out with this..

    P.S. If anyone needs pic18f45k20... I got loads of them.... Duh!!
     
  14. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    The Proton Amicus free complier program used only the 18K25K20...maybe they didn't want it to be too successful? (They may have added the '22 after years of begging).

    Ugh. I really dislike 3.3v only parts!


    Tumbleweed, perhaps I should hsve said the traditional chips better suit MrDEB's unique programming style?
     
  15. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,391
    Likes:
    22
    I like Pommies idea of a 4 x 5 matrix to read the switches and enable desired LED. Just need to take a closer look at implementing the idea.
    thinking using byte to determine which switch has changed state.
    more research to best approach
     
  16. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    If more than one switch may be pressed at a time, Mik's solution won't work so well.....
     
  17. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    This probably has nothing to do with what MrDEB is trying to do but he hasn't been too clear about that so who knows.

    This is a random thought. MrDEB, just ignore this if it doesn't apply.

    If one wanted a "buzz in" system where the first button to be pressed has control and the rest are ignored, for up to 8 switches, an MCP 23008 or MCP23017 would do all the work for you. Interupt-on-change detwcts when any switch is pressed, and one of the registers

    But even if you use the MCP23017 with 16 I/O pins, you are limited to 8 switches. The chip is divided into separate halves.
     
  18. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,391
    Likes:
    22
    been running over ideas and if more than one key is pressed then all bets are off.
    going hunting for a LF series chip in a 44 pin smd and hopefully not a K series.
     
  19. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    images(17).jpg

    Hunting rabbits...I mean PICs...is a very arduous task, made even more difficult when recommendations have been made. Mike's recommendation includes EEPROM, so lets go with that just in case there turns out to be some reason you do need to save some info between games.

    Mike recommended the 18F2620 or the 18F4620.

    Here's the first secret you must have been ignoring on the front of the data sheet:

    - 2620: 28 pin part
    - 4620: 40 pin part
    Only the first digit changes to go from a 28 pin part to a 40 pin part.

    Stop sputtering - the TQFP package has 44 pins, but 4 of those are nc. It's exactly the same part as the 40 pin DIP package inside.

    "But I want the LF version..."

    Stop whining. For the baseline series, there is always an LF version.

    18LF4620 should be just what you need.

    So let the hunt begin. 10 seconds on Octopart and you'll know what's available. Very difficult.

    SmartSelectImage_2017-11-10-07-45-58.png

    But how can you be sure that's the part you really want? 2 to 4 and add L? Who believes that works? Microchip will show you it is. Note, there isn't a separate spec page for the LF version.

    20171110_075223.jpg
     
  20. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,159
    Likes:
    98
    Location:
    Seattle, WA
    Connect your switches to Port B whether or not you use the 40 pin version. Don't design in something stupid from the start. "It got the wrong reading. I told you, only one person can press their button at a time!!!"
     
  21. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,242
    Likes:
    911
    Location:
    Rochdale UK
    Looking at the swordfish device list:--- Funny how the pic18f4520 has been missed off the list...I very much doubt its not supported..
     

Share This Page