ATTiny2313 Nim Game with 16x2 LCD

Discussion in 'The Projects Forum' started by Robert.Adams, Jan 17, 2012.

  1. Robert.Adams

    Thread Starter Active Member

    Feb 16, 2010
    I'm working on a project to implement a handheld version of the game Nim for fun. The game would have two button inputs, one for editing the number you wish to take from the pot and one for submitting your move. The game would then move to Player 2 and you'd hand the device off.

    I've never done any work with micros (besides arduino and that doesn't involve designing around the micro) in my electronics design so I'm a little nervous about it. My schematic is attached. I'm thinking of using the extra I/O to implement an optional FRAM interface in case the on-board 2k isn't enough for my program.

    EDIT: Forgot to mention the 6 pin ISP interface. I know I won't be able to use certain ISP programmers that use 5V from the programmer since this is too high for the display. Luckily the atmel programmer relies on board power.
  2. MrChips


    Oct 2, 2009
    I think it is doable, but why NIM? The user interface may be a bit complicated.
    What not start off with something simpler, maybe Tic-Tac-Toe?

    What kind of display are you using? What can it display?
  3. Robert.Adams

    Thread Starter Active Member

    Feb 16, 2010
    Nim is simple and completely fixed if you know how to play. I'd like to be able to demonstrate basic game theory to people with it (and show it off for job interviews). I've done micro programming before in Assembly and C for the HCS12 but I've never designed a circuit with a micro in it.

    I'm planning on using NHD-C0216Ciz-FSW-FBW-3V3 for the display. It is a 16x2 display so I plan on having the top line be something like:

    "XX XX XX "
    "Take: X "

    Then the user presses the edit button until they are taking from the correct pile and then they choose how much to take by scrolling through numbers with the edit button.

    I think I should add a back button in case they choose the wrong pile and need to return to heap selection.
    Last edited: Jan 17, 2012
  4. hgmjr

    Retired Moderator

    Jan 28, 2005
    The Atmel AVRISP mkII In-System Programmer (ATAVRISP2) is one of those AVR ISP programmers that uses the ISP6PIN AVR programming interface. It uses the target power supply and will work down to 1.8V taget voltages.

  5. Jony130

    AAC Fanatic!

    Feb 17, 2009
    ATtiny2313 has internal pull-up resistors, so you don't need external pull-up resistors.
    You set DDRX as a input 0 and you active pull-up by setting PORTX = 1
  6. Robert.Adams

    Thread Starter Active Member

    Feb 16, 2010
    I learned it also has the 10 pin interface but you need to cable it and bring it out yourself. Unfortunately it also costs more than others like Ladyada's. I'm hoping to find a cheaper open source one that runs on module power or provided 3.3V instead of 5V.

    As far as the pull-up resistor goes, I saw it in a schematic somewhere and figured I'd add it. I think I'll leave the pad in the layout so I can make it a stronger pull-up if I need it.