Shop OBEX P1 Docs P2 Docs Learn Events
3x4 keypad and 7 segments. — Parallax Forums

3x4 keypad and 7 segments.

The_ApprenticeThe_Apprentice Posts: 15
edited 2007-10-14 18:11 in BASIC Stamp
Hello everybody,

I need some help with my project. I'm planning to use a 3x4 keypad and a display with 2 7segments. The plan is to display in the 7segments the number what is press in the keypad.

If any body have any idea or tip I would really appreciate.

Thanks

Comments

  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-09-28 19:55
    You may want to look at the SX-28. They have an example showing how to do something very much like this using a 4x4 keypad and 7 segment display. I have modified it for an old radio shack 3x5 display which should help. It should also be possible to convert this into PBASIC. See attached.
  • Dave-WDave-W Posts: 94
    edited 2007-10-14 18:11
    Go to the Parallax site. Look at the code for the Stamp Works board. Lots of examples. Here is the seven segment part.

    ' ==============================================================================
    '
    ' File...... Ex08 - SevenSegs.BS2
    ' Purpose... 7-Segment Display
    ' Author.... Parallax
    ' E-mail.... stamptech@parallaxinc.com
    ' Started...
    ' Updated... 01 MAY 2002
    '
    ' {$STAMP BS2}
    '
    ' ==============================================================================


    '
    ' Program Description
    '

    ' Displays digits on a 7-segment display.


    '
    ' I/O Definitions
    '

    Segs VAR OUTL ' 7-segment LEDs


    '
    ' Constants
    '

    Blank CON %00000000 ' clears the display


    '
    ' Variables
    '

    counter VAR Nib


    '
    ' EEPROM Data
    '

    ' Segments .abcdefg
    '
    DecDig DATA %01111110 ' 0
    DATA %00110000 ' 1
    DATA %01101101 ' 2
    DATA %01111001 ' 3
    DATA %00110011 ' 4
    DATA %01011011 ' 5
    DATA %01011111 ' 6
    DATA %01110000 ' 7
    DATA %01111111 ' 8
    DATA %01111011 ' 9


    '
    ' Initialization
    '

    Initialize:
    DIRL = %11111111 ' make segments outputs


    '
    ' Program Code
    '

    Main:
    FOR counter = 0 TO 9 ' count
    READ (DecDig + counter), Segs ' put 7-seg pattern on digit
    PAUSE 1000 ' show for about one second
    NEXT
    GOTO Main ' do it all again

    END

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D. A. Wreski
Sign In or Register to comment.