Complete Noob in the Realm of BASIC
AutoAttenuation
Posts: 3
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
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.
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.
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.
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
·
@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.