Shop OBEX P1 Docs P2 Docs Learn Events
Complete Noob in the Realm of BASIC — Parallax Forums

Complete Noob in the Realm of BASIC

AutoAttenuationAutoAttenuation Posts: 3
edited 2009-07-21 19:59 in BASIC Stamp
I am just starting out with BASIC and have my shiny new BOE and BS2e ready to go. I have a need to set this up for four inputs from DIP switches representing a BCD input and would like to drive a 7 segment display with the appropriate character 0-F based on how the DIPs are toggled. Is there an easier way of doing this than simply running through the 16 input combinations and assigning all seven outputs for each case?

Comments

  • Lab RatLab Rat Posts: 289
    edited 2009-07-20 18:54
    to be honest the simplest way does not even incude the stamp
    the simplest method for driving the display is a binary display driver in takes your binary and converts it right into numbers granted it will no do hexadecimal like you are asking about

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax posesses power beyond belief.

    Believe in it.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-20 19:09
    As with any project like this, you build it up in pieces.

    Get your 7 segment display working. The "What's a Microcontroller?" tutorial should have several examples showing how to hook up an LED to a Stamp and get it working. Make sure you can get each LED to light. It's best to use 8 pins in a group (7 segments + decimal point), either P0-P7 or P8-P15. This way you can set all 8 bits of the output register with OUTH or OUTL. Choose the series resistor so you don't draw too much current from the group of pins. I think it's limited to 50mA or 6mA per LED. For red LEDs, that would need a 560 Ohm resistor for each LED (or higher).

    Next step is to get the DIP switches to work. The tutorial also has examples on reading switches. Wire that up for each of the 4 switches and make sure that your Stamp can read the switches in any combination. Best would be to use a group of 4 I/O pins to read the 4 switches. If you're using P0-P7 for the LEDS, use P8-P11 for the DIP switches so you can read all 4 in by referencing INC (see the Stamp Manual discussion on I/O registers).

    Last step is to take the 0-15 value from INC and use either a LOOKUP statement or a DATA / READ statement to select one of 16 table entries to be sent to OUTL, then repeat the whole thing.
  • Lab RatLab Rat Posts: 289
    edited 2009-07-20 19:19
    ok you win you know more about the stamp lol
    my powers for programming the stamps are weak i am a very experience ladder logic programmer but thats about it

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax posesses power beyond belief.

    Believe in it.
  • tronsnavytronsnavy Posts: 70
    edited 2009-07-21 14:40
    Here is an idea for anyone that wants to use 4·stamp·I/O pins·vice 8 for driving an LCD or any other item.· Use the 7447 BCD to 7-segment display chip.· Instead of using 8 output pins on your stamp, you only have to use 4.· This leaves you with 12 I/O pins vice 8.· Keep in mind that you must program in BCD for the 4 pins.·

    You can use the 7442 as a BCD to decimal decoder.· This provides 10 outputs for 4 inputs.· The 7447 can sink about 40mA per output pin.· The 7442 can sink about 20mA.· See attachment.· Both chips work great.· I made a clock using these chips (along with 7490's).· I have not used these chips with the stamp but they should work.· Hope this helps.

    http://www.scribd.com/doc/24071/74-Series-Logic-ICs

    Have a good one.

    Bob
    ·
  • AutoAttenuationAutoAttenuation Posts: 3
    edited 2009-07-21 19:59
    @Lab Rat @tronsnavy thanks for the input on BCD to 7 segment decoders, I am very aware of the existence of these devices and would much rather use those but I have been tasked with specifically using the stamp.

    @Mike Green I appreciate the input on getting started, I may have overstated my "noobiness" a little. I can make LEDs light up all day long and read inputs from DIPs. Your comments regarding INC and the LOOKUP statement definitely seem like they will put me on the right track so thank you for those especially.


    Thanks again everyone for your input.
Sign In or Register to comment.