7 segment problems

Hi. I have problems with 7 segment display (5641ah) with arduino . I want make digital tempmeter, and you know at it needs lot of numbers. How i do it? I don´t want to do it with switch() {}, because the code should be very long and i don´t want it. I don´t need a ready-made code, i only need help with understanding the code language. Should i use byte command?

Make an array with all the numbers as bytes.


byte Numbers[] = {
  B11111110, // 0
  B01100000, // 1
  B11111011 // 9

When you want to show a number, you call a function that cycles through each bit within that number and turns on the corresponding led segment.


how i turn those byte on, and how i "name" them? After the byte command comes [], and what i put there? Can i multiplex display with byte? If i have code and i want to print number, what i have to write to loop()? And how i can use many digits? I think at you all thinks i´m stupid because i ask things like that and i´m sorry about it but i just have to know...

byte seven_seg_digits[10][7] = { { 1,1,1,1,1,1,0 },  // = 0
                                 { 0,1,1,0,0,0,0 },  // = 1
                                 { 1,1,0,1,1,0,1 },  // = 2
                                 { 1,1,1,1,0,0,1 },  // = 3
                                 { 0,1,1,0,0,1,1 },  // = 4
                                 { 1,0,1,1,0,1,1 },  // = 5
                                 { 1,0,1,1,1,1,1 },  // = 6
                                 { 1,1,1,0,0,0,0 },  // = 7
                                 { 1,1,1,1,1,1,1 },  // = 8
                                 { 1,1,1,0,0,1,1 }   // = 9

No one is thinking you are stupid, but if you do the research and know what questions to ask, then you will find your answers. Check out the arduino reference page http://www.arduino.cc/en/Reference/HomePage
Look up other peoples solutions, try the example sketches and learn how to interface the arduino with other devices.

Using the bitRead() and a for loop, you can read the bits from my table and turn on the LEDs. But you need to first understand how to connect the display.

Maybe your display already has a premade library in which case all you need to do is find it on google.

How are you connecting to the display? That can make a difference as to how you write your code.

I use shift registers a lot to drive the display. Then it's a simple matter to shift the data in. Using an array like HazardsMind posted:

digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, Numbers[numberToDisplay]);
digitalWrite (latchPin, HIGH);

where each line of Numbers[] represents segments a-b-c-d-e-f-g-DP fro, Q7 to Q0 and the display is set up like this:

 f         b
 e        c
      d          DP

Numbers[] only needs 10 bytes of memory. Your array byte seven_seg_digits[10][7] needs 70 bytes, which is a waste or memory, and slower.

I think at i could do it with Attiny85, but i think at i can´t do it, because it have only few pins. I have one mc74gc595an but i think at it makes code difficult to me(i have already problems with Arduino language). I used Arduino´s product search, but i didn´t find anything good to this project. Anyone know good Atmels´or someone´s product i could use in my project(Temperature meter with 7seg 4digit display) and i don´t want to make the circuit difficulty so i want processor witch don´t need crystal. (succinctly said i need something whose i can program with arduino and it needs to run my 7seg display with 595. Hope you got the idea and i´m speaking only bullshit in that topic, so i´m sorry about it)

You have a 4-digit, 7-segment display with 11 or 12 pins? Is it common anode, example http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12CGKWA(Ver.7A).pdf or common cathode, example http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12CGKWA(Ver.7A).pdf Or something else?

Attiny85 has only 6 IO pins. You can drive 2 shift registers, daisy chained with 3 pins (clock and latch to both, serial data passed from the 1st chip to the 2nd) and write code that multiplexes the data so that all digits appear to be active (look up "persistence of vision"). One shift register will hold the 7-segment information. The other will drive the common anode or common cathode. I won't go further until you can determine what kind of display you have.

My display is 5641ah 7seg, 4digit, common cathode 12 pin led display. I informed of that earlier(first message in this topic) Anyone know good Atmel product i could use in this project? (I´m having now only 2 Atmega328 and 2 Attiny85) Should i use byte seven_seg_digits[10][1] or what? (i have no idea what that means)