PIC chip for dip switch replacement

Discussion in 'Embedded Systems and Microcontrollers' started by Synaps3, Sep 27, 2013.

  1. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    I have started a project using a circuit that has 8 dip switches that represent a binary number. I need to be able to replace these dip switches with a microcontroller and a small LCD screen. The screen will display the decimal number 1000 and will have two buttons for incrementing and decrementing that number. Each time the number is changed, the dip switches need to be changed to represent the number. It would also be nice if it had a little watch battery to save the number when it's powered off.

    This seems like it would be a relatively simple project, but I have never programmed a PIC chip before. I am an experienced windows programmer in C# though, so I don't think it would be very hard for me to do. I don't really know much about microcontrollers, what chip do you think would be the cheapest and most effective for this application? Do I even need to program a chip? Is there already something that does this?
     
  2. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,965
    743
    8 dip switches will only go up to 256, you need 10 to go 1000.
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    PICs also do have a EPROM/Flash on board so you do not need a backup battery
     
  4. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,498
    2,364
    What are the individual dip switches actually doing?
    If you "need to be able to replace these dip switches with a micro-controller"
    Could you not replace them with a 4x4 multi-plexed keypad into the Micro, and then use a port(s) on the micro to do what the dip switches did?
    Max.
     
  5. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    You're right. For some reason the manual for the board was telling me you only need to modify the first 8 switches. I was probably just reading too fast and not understanding the circumstances. There are 12 dip switches.I just checked the board.

    Controlling the frequency of a PLL.

    I'd like to just have an up and down button rather than a keypad. It won't need to be changed often and a keypad is kind of bulky for what I'm building. "Just use the ports on the micro" is too vague for me. I've never used a micro before, so I need suggestions on which one I should choose. How it's used would be nice too :) The cost of the programmer is also something to consider.
     
  6. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,498
    2,364
    I did not mean replace the up/dwn buttons with the keypad, but the dip switches?
    Max.
     
  7. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    There is no replacing the up/down buttons, it doesn't have that yet. That's what I'm looking to add to it. The up/down would + or - the frequency by 1. Either way, a keypad is not what I'm looking for.
     
  8. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    These two images should give you an idea of what I'm doing. This is NOT the actual board I'm using, it should just give you a general idea of what I'm trying to do.

    This board is similar to what I'm working with (notice the dip switches):
    http://www.gloeidraad.nl/radioforumservice/images/artikelen/PLL AM zender gereed2.jpg

    I'm trying to replace the switches to make it more like this one with the LCD and up/down buttons. Third button is not necessary on mine:
    http://images01.olx.com.br/ui/18/04...5_1-Fotos-de--Transmissor-AM-PLL-10-Watts.jpg
     
  9. MrChips

    Moderator

    Oct 2, 2009
    12,414
    3,353
    What you need are two push buttons, up/down or +/-.

    It is a pain to set a value between 0 and 999 if you are going to increment/decrement by 1. What you need is an intelligent algorithm that increments the increment the longer you press the button.

    Been there, done that.
     
  10. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    You're right, I didn't think about that. Shouldn't be too hard though if I just have it time how long the button is pressed and then increase the speed to a fixed amount rather than ramp it up which sounds harder. Anyway,I don't think the programming will be a problem because I'm very experienced in C# and VB and I can pick up new languages pretty well. AFAIK micros can be programmed in C, assembly, or BASIC, right? As long as I don't have to use assembly,I'll be ok. Just need a suggestion on what micro I should use and the programmer. And um... maybe how to do it ;)

    Thanks for the quick responses!
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,414
    3,353
    Just about any mcu will do as long as you have sufficient pins. Count the number of pins you need.

    2 - buttons
    12 - outputs to DIP switches
    7 - LCD
    2 - POWER + GND

    Hence you need an mcu that has at least three ports, perhaps a 28-pin chip.
     
  12. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,498
    2,364
    I am still not sure why you would need the dip switches?
    These seem a very cumbersome way for general inputs, and is not very intuitive for human input in binary.
    If you are using a Pic then I would have thought that you make use of the processing power to eliminate them or at least have a method a little more intuitive such as multi-plex three miniature decimal thumb wheel switches, three just needs 4 inputs, 3 outputs (one port) total?
    These also give instant feedback as to the entered number in a little more of a readable form.
    The can also be used to enter a number to be displayed instead of increment with push buttons?
    Max.
     
  13. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,790
    826
    I don't think he needs 12 dip switches. I think he needs to output 12 bits of data. Even if he used the thumbwheel method, there must be a way to perform the BCD to binary conversion.

    Edit: Never mind, I see that Max and I are saying the same thing.
    And I can multiplex the input with 6 pins.

    OP, am I wrong in my first assumption?
     
    Last edited: Sep 29, 2013
  14. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,498
    2,364
    Yes, Three multiplexed BCD T.W.'s would take 4in and 3 outputs.
    Max.
     
Loading...