Machine programming a 7segment LED

AI Thread Summary
The discussion centers on understanding the basics of programming a 7-segment LED display using a keypad. Participants explore how pressing keys on the keypad sends signals to the processor, which controls the LED segments. They clarify the concepts of common cathode and common anode displays, explaining that each configuration affects how the segments are powered. The conversation also emphasizes starting with simple projects to build foundational knowledge in electronics and programming, particularly using Microchip PIC chips. Overall, the focus is on grasping fundamental terms and concepts to effectively control a 7-segment LED display.
Loki23
Messages
11
Reaction score
0
Hello,

Lately I've been trying to gain an understanding of processors/cpu's and the very lowest possible code you can engineer. I decided I would do a thought experiment where I would distill the computer down to the most basic level I could conceive, and decided that such a computer would be a single 7 segment LED. That seemed sufficiently simple, yet in some ways, still mysterious to me.

Here's an example of what I mean:

7segled_full1.jpg


Imagine this LED hooked up to a keypad with numbers 0-9, each key sending a different signal to the processor. The processor, as I understand it, is best visualized as a network of on/off switches. But this is too general.

I want to go into more specific details but I'm not sure how. When you press a key on a small 0-9 numbered keypad, what exactly are the interactions occurring to produce the simple 7 bulb display? It's so simple, yet it's still not easy to see.

I put together another gif of the next step in complexity, primitive animation:

7seganimation.gif
 

Attachments

  • 7segled_full1.jpg
    7segled_full1.jpg
    4.3 KB · Views: 334
  • 7seganimation.gif
    7seganimation.gif
    9.2 KB · Views: 429
Engineering news on Phys.org
I'm not sure if there is a question in your post, but if you want to pursue the "simplest" computer program to make your gif example in "reality" I would suggest looking into the Microchip PIC chips, perhaps the 16F818. You can find some free C compilers and assemblers...I would start with C, and then look at the assembly code...and go to town.
I think sparkfun.com may have some kits and stuff that you could use to get going. Microchip has programmers and software but seems to want money in exchange...
 
At the most basic level you don't need any code or even a processor. All you need to do is connect the cathode of each LED to ground and connect the anodes of the LEDs through diodes to the ten switches. For instance the switch for the number one would have two separate connections through resistors and forward biased diodes to the two rightmost vertical LED segments. The keys for all the other numbers could be hard wired through resistors and diodes to the segments they're are supposed to light.

If you want to use code and a processor then each digit (0..9) is mapped to a character that represents the seven segments (or eight if you count decimal points) and sent to the output port. The LED segments are connected to the output port and are lit when the 7 segment character is output.
 
skeptic2 said:
At the most basic level you don't need any code or even a processor. All you need to do is connect the cathode of each LED to ground and connect the anodes of the LEDs through diodes to the ten switches.

Hold on a second. When you say each LED, are you talking about each of the 7 bulbs that comprise a single 7 seg LED?
 
Getting used to processors can be intimidating. If your doing this outside of a supporting group, I recommend you start with a project that works. Then, modify it and learn the nomenclature and import of the pieces. There are some books with support code. As I recall, the PIC parts are good about this.

Best Wishes,

Mike
 
Loki23 said:
Hold on a second. When you say each LED, are you talking about each of the 7 bulbs that comprise a single 7 seg LED?

Yes, each 7 segment LED comes with a pin for each segment plus a common. I was assuming common cathode but there probably also are common anode 7 segment displays. In that case the cathode of the appropriate segments would be pulled low.
 
skeptic2 said:
Yes, each 7 segment LED comes with a pin for each segment plus a common. I was assuming common cathode but there probably also are common anode 7 segment displays. In that case the cathode of the appropriate segments would be pulled low.

Can we explore some extremely basic things based on what you just wrote?

Terms I am not familiar with:

pin (an anode?)
common (a cathode?)

I also don't know what you mean by "assuming a common cathode" what do you mean?

All I really know at this point is that electricity flows into the anode and out the cathode. I hardly know much else. Just hoping you could explain things as fundamentally as possible, even if that means helping me get a handle on some of the most rudimentary terms in electronics.

What would be the difference between a common cathode and common anode display?

What does it mean to pull the cathode low? no idea what that would mean.
 
Mike_In_Plano said:
Getting used to processors can be intimidating.

Extremely. I don't even want to try to tackle it without getting a grasp on engineering a keypad to light up 10 different combinations of lights (0 - 9). That's boggling enough.

If you're doing this outside of a supporting group, I recommend you start with a project that works.

Can you give me an example of such a project? Let's keep it real simple too, for instance, do you think it's appropriate for me to focus on 7 seg LEDS?

Then, modify it and learn the nomenclature and import of the pieces. There are some books with support code. As I recall, the PIC parts are good about this.

What do you mean by importing pieces? I'm not sure code is the best place for me to start. I understand a bit of programming (python), but I really want to focus on the most fundamental thing I can think of, and that is a single 7 seg LED fed by a 0 to 9 digit keypad.
 
Whats your backround Loki23?
You might want to try with some chips that don't have much complicated syntax. I have used Lego mindstorms, paralax robotic kit, and trying now to do some project on PIC. Lego and paralax have some simle and intuitive development software.
 
  • #10
Loki23, common anode means that all 7 anodes of the 7-segment display are tied (connected) together. Common cathode is the same, except with cathodes connected instead. If you think about it, you only need to control one end of an LED to turn it on or off.

Pulling something low means connecting (via your microcontroller) that something to ground. Pulling high means connecting it to 5V or whatever your voltage happens to be. Note that most LEDs can't handle 5V directly, and you need a small resistor in-between your input and the LED.
 
  • #11
...and pin refers to the wire lead coming out of the 7 segment module.
 
Back
Top