Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: cupstacker on Nov 29, 2013, 08:25 am

Title: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 08:25 am
i have a single 3 digit 7 segment led display - 11 pin
(http://thumbs1.ebaystatic.com/d/l225/m/mUy_vt9yh4aoJhJ0elvOZgA.jpg)

i also have some 74hc595's and MAX7219's to connect the segment display to - (i don't know which is best but i think it will be 74hc595??0.. i do not need the DP

11 buttons will control this display as follows
buttons 1-10 will consist of double press to fill the display, example of this

button 1 - you press once to get the letter A and then say you press button 1 again the display will be A01

buttons 1-10 are A-J and 1-10.... (A/21, B/2,C/3.....J/10)

button 11 will start the display at 000 and be the SET button

SEQUENCE

button 11 sets display to 000 buttons 1-10 are useless until this happens
select a letter with buttons 1-10
select a number with buttons 1-10
button 11 clears display - button 11 is useless until the above 2 steps happen

with whatever was set with button 11 will turn on a certain set of leds.. for now though i have a bi-color led for testing so let's go with A01 the bi-color led turns on red and A02 the bi-color turns on green

END SEQUENCE

keep in mind that there will be an on/off switch to turn on before any buttons can be used.. but i am not concerend about that right now, just keep that in mind for later

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Grumpy_Mike on Nov 29, 2013, 09:48 am
Is there a question here?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 10:41 am
maybe i should have questioned it better. how do i connect the segment display to 74hc595's and looking for some coding help. basically was going from my previous topic to this one because i changed the concept of the project, see my topic "delete this topic please". i posted this one right after and asked the other one to be deleted.

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: TomGeorge on Nov 29, 2013, 11:14 am
Hi,
How are you going to display 0 (zero) and D, unless you use lower case d.
Display 1 (one) and i, you will have to use a single vertical segment for i.
I gather you want to display any combination A01 to A10, B01 to B10, etc up to J01 to J10.
The 11th button does a clear, 000.
Do I have the concept right.
All the buttons means you keep the maximum number of presses for any number will be 10, to get A10 or B10 etc.

You could use two rotary encoded switches, one switch as you turn it , selects A to J.
The other switch selects 1 to 10.
This way is you get the letter or number wrong you just turn the rotary switch back or forward to the right one.
It simplfies the controls to two knobs and a reset button.

Tom... :)
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 11:28 am
yes, they will be all lowercase..  i don't like the rotary switches idea.. they must be push buttons.. could always add a clear button if needed.

my main concern is wiring up to the chip

thank you

Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 12:43 pm
Just use the MAX7219 - makes it all so easy.  If you try to use the 74hc595, you are up for driver transistors, resistors and ten port lines.  The MAX7219 uses three lines, one resistor a couple of bypass capacitors and does all the multiplexing for you.  Even if it is the wrong common cathode/ anode for your display (you did not specify) and you cannot use the built-in character generator in the MAX7219, it will be preferable.  And you do not need a library for it.

Obviously you are going to matrix your 11 buttons.

No decimal points.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 09:51 pm
Quote
one resistor a couple of bypass capacitors


ok, but how do i connect it all to the max7219? i haven't found a tutorial or anything on it..

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Grumpy_Mike on Nov 29, 2013, 09:56 pm
Well there is always the data sheet.
Or google even
http://playground.arduino.cc/LEDMatrix/Max7219 (http://playground.arduino.cc/LEDMatrix/Max7219)
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 09:59 pm
Basically, it's all in the datasheet (http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf).

I am kind of waiting for you to specify your display - common cathode or anode and pin numbering.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 10:02 pm
i wouldn't be able to tell you, i got it from someone who had gotten it awhile ago and does not remember.. all i do know it has 11 pins.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 10:05 pm

Or google even
http://playground.arduino.cc/LEDMatrix/Max7219 (http://playground.arduino.cc/LEDMatrix/Max7219)


I love the way that code is listed there - with the line numbers!


I wouldn't be able to tell you, I got it from someone who had gotten it awhile ago and does not remember.. all I do know it has 10 pins.


That is going to slow things down, isn't it?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 10:12 pm
OK, we now know it is a common cathode display (http://www.ebay.com.au/itm/5PCS-0-56-inch-3-digit-Red-Led-display-7-segment-Common-cathode-GOOD-QUALITY-/121186563400).




Ahh!  I could have sworn that you said it had ten pins.  Seems it has eleven.  And I think we know the pin numbering (http://pliki.digi-led.pl/noty/elektronika/LED-WA3-5361.pdf).

That plus the datasheet (http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf), should get you wiring it up.

Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 10:16 pm
3bit Common Anode Digital Tube 0.36in. red LED - still don't see how to connect it to a max7219 OR a 74hc595..
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 29, 2013, 10:37 pm

i also have some 74hc595's and MAX7219's to connect the segment display to ...


Funnily enough I have a page about connecting LEDs to a MAX7219.

http://www.gammon.com.au/forum/?id=11516

Half-way down that page I illustrate using a 4-digit LED, a 3-digit one will be similar.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 29, 2013, 10:40 pm
I think you can make common anode ones work by reversing the way the 7219 operates. Get it to sink rather than source current. I'm not sure about that. I think CrossRoads is the expert on that sort of thing.

Or this page: http://www.gammon.com.au/forum/?id=12298

That shows a scrolling LED display using the 595 chips. Those are set up to sink current.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 10:44 pm
Turns out the MAX7219 actually has the character generator to drive 7-segment common cathode displays - but only with digits "1" to "9", "-" and the characters "E", "H", "L", "P" in Table 5 (useful for spelling "HELP").  If you want other characters, you will have to code all characters yourself.

Wiring is given in the "Typical Application Circuit" on the first page, various other information including the current-setting resistor value according to how many active digits there are.

Nick, you need to put "<a name =" links into your pages so you can reference individual sub-topics.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 29, 2013, 10:47 pm

ok, but how do i connect it all to the max7219? i haven't found a tutorial or anything on it..


I found one here (http://www.lmgtfy.com/?q=max7219+tutorial). Well, quite a lot more than one.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 29, 2013, 10:50 pm

Nick, you need to put "<a name =" links into your pages so you can reference individual sub-topics.


I did that a while back for each reply on my pages. If you RH-click on "Reply #1" for example (at the start of a reply) and "Copy Link Location" you get a useable link with an anchor:

http://www.gammon.com.au/forum/?id=11516&reply=1#reply1
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 10:58 pm

I did that a while back for each reply on my pages. If you RH-click on "Reply #1" for example (at the start of a reply) and "Copy Link Location" you get a usable link with an anchor (http://www.gammon.com.au/forum/?id=11516&reply=1#reply1)


Ah yes.  sorry, I didn't search your source properly for anchors.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 29, 2013, 11:19 pm
your display is  lot different..  http://www.gammon.com.au/forum/?id=11516 (http://www.gammon.com.au/forum/?id=11516)

you have 8 pins on one side and 4 on the other where as i have 5 on one side and 6 on the other.. to me there is no comparison

all the tutorials i find are specifically for 4 digit and 8 digit and the pins are different so therefore they must be wired differently and so is the coding i'm sure.

is there a specific diagram for 3 digit 11 pin?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 29, 2013, 11:30 pm

is there a specific diagram for 3 digit 11 pin?


Didn't you like the one I gave you?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 29, 2013, 11:33 pm

you have 8 pins on one side and 4 on the other where as i have 5 on one side and 6 on the other.. to me there is no comparison


Mine has 12 pins, and yours has 11. Mine has one more segment which would account for the extra pin. So yes, there's a comparison. And that's why you have datasheets, they tell you what is connected to what.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 30, 2013, 12:02 am
I just want to point out, before you get too bogged down, you can buy these things from eBay for $10.

(http://www.gammon.com.au/images/Arduino/HHS_Temperature_Logger4.png)

(http://www.gammon.com.au/images/Arduino/HHS_Temperature_Logger5.png)

(http://www.gammon.com.au/images/Arduino/Arduino_forum_192209b.png)

You get 8 digits, the MAX7219 chip, the board, two capacitors and a resistor. Just solder it all together and you can display 8 digits, driven by four wires (Power, Ground, Data in, Clock).

You can even chain those boards together to get 16 digits:

(http://www.gammon.com.au/images/Arduino/Arduino_forum_201744.jpg)
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 12:15 am
that's pretty neat, but this project just involves only a 3 digit display.. nothing more fancy than that

all i know is i got this mess and don't know what to do with it  :(
http://cdn.img42.com/183cf65cd9739615c8fc41f75e7eaf22.jpeg

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Nov 30, 2013, 12:15 am
MAX7219 expects to source current into 8 anodes and and sink current from 1 digit.
You have to add extra hardware to use common anode, see this application note:
http://www.maximintegrated.com/app-notes/index.mvp/id/1196
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 12:19 am
what kind of extra hardware?

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Nov 30, 2013, 12:33 am
Read the datasheet - shows which type of transistors and how to connect them.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 30, 2013, 12:36 am

MAX7219 expects to source current into 8 anodes and and sink current from 1 digit.
You have to add extra hardware to use common anode, see this application note:
http://www.maximintegrated.com/app-notes/index.mvp/id/1196


The display he has is a common cathode.  It only matters anyway if you wish to use the character generator which is limited to digits 1 to 9 and the characters "-EHLP" - if you wish to define other characters, you cannot use the internal character generator anyway.

I have previously cited the MAX7219 data sheet which has the connection diagram on the first page, and the pin diagram for the display he has.  It is only a matter of connecting the corresponding pins from one to the other, adding a 33k resistor as per the datasheet (and some bypass capacitors), and using the code Nick provided.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Nov 30, 2013, 12:39 am

It only matters anyway if you wish to use the character generator which is limited to digits 1 to 9 and the characters "-EHLP" - if you wish to define other characters, you cannot use the internal character generator anyway.


Whether or not you use the internal character generator does not affect the electrical characteristics of the chip. That internal generator just saves you having to code bit patterns into your code if you happen to only want digits and/or the other characters you mentioned.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Nov 30, 2013, 01:14 am
Here's a MAX7219 with 3-digit common cathode display.
Change the display to match your pinouts.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 01:31 am
giving up for now.. i said i was new to all this and right now it's just upsetting me and just making me want to stop for now. i don't know as much as any of you.

didn't know a 3 digit display and a chip would be so complicated to wire up and nobody can tell me where these wires go on the chip.. and i didn't even want the dots.. was even trying to make it easier, but guess not  :smiley-sad-blue:
(http://cdn.img42.com/66245e9ec3a79feaa8f0bf8417e5a180.png)

thank you everyone for trying to help though
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Nov 30, 2013, 04:36 am
Overcoming the latest hurdle, understanding the package. Not all pins may exist (i.e. pin 6) - count the gap as pin if it is not there.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: graynomad on Nov 30, 2013, 04:50 am
Quote
nobody can tell me where these wires go on the chip

What's wrong with Crossroad's schematic, all you have to do is identify the segment pins and the cathode pins on your display and modify the schematic accordingly.

So for example CR's drawing shows seg A on pin 1, you find where seg A is on your display and put the wire to that instead. etc etc.

______
Rob
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 05:10 am
i think i got it.. took me some time..
(http://cdn.img42.com/771ddad2f0a586a8a326d6da80b43693.jpeg)

if that's right, now i need to know how to connect the chip to arduino and find some temp code just to see it working.. i didn't connect DP (3) because i will not be using it.

max7219 pins 4 & 9 are ground and 19 is power

arduino pin 12 is connected to the MAX7219 pin 1
arduino pin 11 is connected to the CLK pin 13
arduino pin 10 is connected to LOAD pin 12

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: billhowl on Nov 30, 2013, 06:19 am
I saw you are using Arduino Mega which have a different pins for SPI
please check here http://arduino.cc/en/Reference/SPI (http://arduino.cc/en/Reference/SPI)



Here are the code to test the MAX7219
Code: [Select]
#include <SPI.h>

const byte MAX7219_REG_NOOP        = 0x0;
// codes 1 to 8 are digit positions 1 to 8
const byte MAX7219_REG_DECODEMODE  = 0x9;
const byte MAX7219_REG_INTENSITY   = 0xA;
const byte MAX7219_REG_SCANLIMIT   = 0xB;
const byte MAX7219_REG_SHUTDOWN    = 0xC;
const byte MAX7219_REG_DISPLAYTEST = 0xF;

void sendByte (const byte reg, const byte data)
  {   
  digitalWrite (SS, LOW);
  SPI.transfer (reg);
  SPI.transfer (data);
  digitalWrite (SS, HIGH);
  }  // end of sendByte

void setup ()
  {
  SPI.begin ();
  sendByte (MAX7219_REG_SCANLIMIT, 2);      // show 3 digits
  sendByte (MAX7219_REG_DECODEMODE, 0xFF);  // use digits (not bit patterns)
  sendByte (MAX7219_REG_DISPLAYTEST, 0);    // no display test
  sendByte (MAX7219_REG_INTENSITY, 7);      // character intensity: range: 0 to 15
  sendByte (MAX7219_REG_SHUTDOWN, 1);       // not in shutdown mode (ie. start it up)
}   // end of setup

void number (const int num)
  {

char buf [4];
sprintf (buf, "%3i", min (max (num, 0), 999));

// send all 3 digits
for (byte digit = 0; digit < 3; digit++)
   {
   byte c = buf [digit];
   if (c == ' ' )
     c = 0xF;  // code for a blank
   else
     c -= '0';
   sendByte (digit + 1, c); 
   }   
  }  // end of number
 
unsigned int i;

void loop ()
{
number (i++);
delay (100);
}  // end of loop

Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 06:52 am
i'm new and have not used SPI yet, probably don't plan to.. if you the exact pins to use please let me know.. otherwise i'll just wait for some normal code

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: billhowl on Nov 30, 2013, 08:40 am

i think i got it.. took me some time..

if that's right, now i need to know how to connect the chip to arduino and find some temp code just to see it working.. i didn't connect DP (3) because i will not be using it.

max7219 pins 4 & 9 are ground and 19 is power

arduino pin 12 is connected to the MAX7219 pin 1
arduino pin 11 is connected to the CLK pin 13
arduino pin 10 is connected to LOAD pin 12

i have my 3 buttons in place, just gotta connect them.. just need demo code to see it count or something so would someone would be so kind so i get to test this thing out please



The connection to MAX7219 is SPI, if you used Mega board then the connection will be
arduino pin 50 is connected to the MAX7219 pin 1
arduino pin 51 is connected to the CLK pin 13
arduino pin 53 is connected to LOAD pin 12


i'm new and have not used SPI yet, probably don't plan to.. if you the exact pins to use please let me know.. otherwise i'll just wait for some normal code



To talk to MAX7219 you have used SPI, this was the code used to control the MAX7219, what "normal code" you talking?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 09:19 am
all i see is 3 8's.. hmm, i could swear i wired it right. i'll look when i wake up again.. it's 3:30am going back to bed

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: Paul__B on Nov 30, 2013, 12:13 pm

To talk to MAX7219 you have used SPI, this was the code used to control the MAX7219, what "normal code" you talking?


I rather think he means code that does not use the SPI.

It is not necessary; perfectly easy to write the code to "bit bang" it.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 02:33 pm
Quote
I rather think he means code that does not use the SPI.

yep
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: graynomad on Nov 30, 2013, 02:51 pm
read up on shiftOut(), that's a bit-banged version of SPI that can use any pins.

______
Rob
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Nov 30, 2013, 03:53 pm
doesn't really help, first off it's using 74HC595's..

all i need is some simple code to see the 3 digits actually working.. can we stay away from SPI, i'm already confused with all this,  i have wiring back to 10,11, 12 (max 12,13, 1)

ok, nevermind a sample code.. i have 11 buttons i would like to connect to it

SEQUENCE
button 11 will "set/initiate" the display to - - - .. all other buttons are useless until this happens
buttons 1 through 10 will set the display to show in the display.. each button will have 2 values per say.. example:

button 1 is to be considered A & 1
button 10 is to be considered J & 10

you can see the rest in between..  so say i wanted the display to show b06, i would press  button 2 and then press button 6 and then press button 1 - (a certain set of leds will be lit, but we are not at this step yet) and then blanks out the display -  i would like to store a value that this button has been pressed at this point

END OF SEQUENCE

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 12:18 am
come to think of it - will the 11 buttons need to be connected to another chip?

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Dec 01, 2013, 01:27 am
You need to separate your thinking into two parts - the data creation, and the data display.
Plagiarizing BillHo's code some:
Code: [Select]

#include <SPI.h>

// set up names for the 14 MAX7219 registers:
const byte MAX7219_REG_NOOP        = 0x00;
// codes 1 to 8 are digit positions 1 to 8, see below
const byte MAX7219_REG_DECODEMODE  = 0x09;
const byte MAX7219_REG_INTENSITY   = 0x0A;
const byte MAX7219_REG_SCANLIMIT   = 0x0B;
const byte MAX7219_REG_SHUTDOWN    = 0x0C;
// registers 0x0D and 0x0E are not used
const byte MAX7219_REG_DISPLAYTEST = 0x0F;
// you have 3 digits, so
const byte MAX7219_DIG0        = 0x01;
const byte MAX7219_DIG0        = 0x02;
const byte MAX7219_DIG0        = 0x03;

// 0x00,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F are same as 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

// and 3 variables to hold data - you will change these later to have different things displayed
byte digit0 = 3;
byte digit1 = 6;
byte digit2 = 9;

byte latchPin = 10; // or whatever pin you used
// 13 SCK will connect to MAX7219 clock
// 11 MOSI will connect to MAX7219 serial data in

// now put some data in the MAX7219 registers, and setup the latchPin - backing off from the function calls

void setup ()
  {
Serial.begin(9600); // setup serial communications for debugging
pinMode (latchPin, OUTPUT);
digitalWrite (latchPin, HIGH);

// turn on SPI library - sets  up the internal hardware for SCK, MISO, MOSI
SPI.begin (); // transfers to the MAX7219 will use default speed of 4 MHz

// now setup the 5 registers that control things
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_REG_SCANLIMIT);      // send address
SPI.transfer (2); // send data to show 3 digits
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

//continue for the other registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_REG_DECODEMODE);      // send address
SPI.transfer (0xFF); // use internal mapping to create the digits
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

//continue for the other registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_REG_DISPLAYTEST);      // send address
SPI.transfer (0); // no display test (display test on turns on all segments)
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

//continue for the other registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_REG_INTENSITY);      // send address
SPI.transfer (7); // mid level intensity, 0 to 15
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

//continue for the other registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_REG_SHUTDOWN);      // send address
SPI.transfer (1); // 1 = not shutdown mode
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

// MAX7219 control registers all set, send some data!
Serial.println ("MAX7219 Setup done");

//continue for the data registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_DIG0);      // send address
SPI.transfer (digit0); // data
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

//continue for the data registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_DIG1);      // send address
SPI.transfer (digit1); // 1 = not shutdown mode
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

//continue for the other registers
digitalWrite (latchPin, LOW);
SPI.transfer (MAX7219_DIG2);      // send address
SPI.transfer (digit2); // 1 = not shutdown mode
digitalWrite (latchPin,  HIGH); // data latched on this signal going Low to High

Serial.println ("End of Setup");
}   // end of setup
void loop(){
}

That should display 3,6,9 for you and send a couple of message to the serial monitor at 9600.

You should be able to read this and find the matching portions of the datasheet to see where the info is coming from.

Get this working, we can discuss reading buttons, changing the values in digit0,digit1, digit2, and sending the updated digits to the MAX7219 for display updates. That will happen in void loop(), which is currently empty.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 03:02 am
const byte MAX7219_DIG0        = 0x02;

error.. says redefinition of 'const byte MAX7219_DIG0'

changed
const byte MAX7219_DIG0        = 0x01;
const byte MAX7219_DIG0        = 0x02;
const byte MAX7219_DIG0        = 0x03;

to

const byte MAX7219_DIG0        = 0x01;
const byte MAX7219_DIG1        = 0x02;
const byte MAX7219_DIG2        = 0x03;

and it uploaded, but nothing happened - all blank
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: graynomad on Dec 01, 2013, 03:09 am
Looks like Bob was caught by the old cut and paste bug.

I think

Code: [Select]
const byte MAX7219_DIG0        = 0x01;
const byte MAX7219_DIG0        = 0x02;
const byte MAX7219_DIG0        = 0x03;


should be

Code: [Select]
const byte MAX7219_DIG0        = 0x01;
const byte MAX7219_DIG1        = 0x02;
const byte MAX7219_DIG2        = 0x03;


______
Rob
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 03:17 am
i mentioned that already before you posted

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Dec 01, 2013, 03:35 am
Did you change the wiring between the Arduino and the MAX7219 as well?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: graynomad on Dec 01, 2013, 03:42 am
Quote
i mentioned that already before you posted

Yep, posts crossed, but mine was first by 3 seconds :)
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 03:46 am
PIN                              Max7219
1 = E                         21
2 = D                      23
3 = DP                      22
4 = C                      20
5 = G                      17
7 = B                      16
8 = common      6
9 = common      11
10 = F                      15
11 = A                      14
12 = common      2

DIN - 12
clock - 11
load - 10

max - 4 & 9 ground
max - 19 power

that's how i have it wired
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Dec 01, 2013, 04:00 am
Please fix your wiring then.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 04:10 am
do i have any of it right? took me awhile to wire it up and i don't read diagrams like that well..

the one i go by is
(http://www.futurlec.com/Maxim/MAX7219.gif)
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Dec 01, 2013, 07:12 am
Do you have:
Arduino-D13 to MAX7219-13?
Arduino-D11 to MAX7219-1?
Arduino-D10 to MAX7219-12?

If you don't  have those control signals connected, the MAX7219 is not going to work with the code provided.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 03:32 pm
yes and still nothing..

(http://cdn.img42.com/2f699a8fde4fd71bd26c2b6024192ae2.png)

also as far as i can gather this segment is an LDS-3361 AX/BX
(http://www.icstation.com/ebay/IMAGE_DING/1866.jpg)
datasheet: http://www.mediafire.com/view/2kzjgay4z4ot41l/MAX7219datasheet.pdf

and as far as i can see, i have my wiring right.. maybe i'm wrong but i don't believe so
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Dec 01, 2013, 05:53 pm
Is yours the AX or the BX?
You said back in reply #12 "3bit Common Anode Digital Tube 0.36in. red LED" which would be BX, which isn't going to work.
Your big picture a few posts back also did not show any capacitors or a resistor from MAX7219 pin 18 to +5, 22K to 33K. Those are also needed.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 06:23 pm
i have put a resistor max 19 to +5 :)

ebay purchase info i got was: 2pcs 3bit Common Anode Digital Tube 0.36in. red LED (121031393167)

the seller:  e_goto

i contacted seller and they gave the following:
Here is the data download link:
http://www.icstation.com/ebay/IMAGE_DING/1866.jpg
http://www.mediafire.com/view/2kzjgay4z4ot41l/MAX7219datasheet.pdf

so as far as AX or BX i do not know or if it's either on 1 side of the display it says 3361BS. and as far as capacitors and resistors i haven't used any simply because i do not know where they go or how many and nobody showed me that.

is it really that complicated to get this single 3 digit segment display to work? if so, i'll just get a couple of different ones cause i'm finding this to be too much BS for these displays!  i mean really.. a lot of work just to get numbers and letters to show and i haven't even got to the 11 buttons yet to make it display what i want it to display yet.  :smiley-red:

i've tried to be really nice on here as a new member, but i'm just about reaching the point of like wth.. tons of "experts" on here and we can't get this display to work? and yet to see someone confirm the wiring i have is correct or incorrect.

thank you
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: arduinodlb on Dec 01, 2013, 08:15 pm

i've tried to be really nice on here as a new member, but i'm just about reaching the point of like wth.. tons of "experts" on here and we can't get this display to work? and yet to see someone confirm the wiring i have is correct or incorrect.


Despite your frustration, don't take it out on the people here who are trying to help you for free.

Your wiring descriptions have been inconsistent, which makes it hard to work out the issue.

A few posts back you said this:
DIN - 12
clock - 11
load - 10

which is inconsistent with:
Arduino-D13 to MAX7219-13?
Arduino-D11 to MAX7219-1?
Arduino-D10 to MAX7219-12?

The photo you took earlier only showed the breadboard, and not how it was connected to your Arduino.


and yet to see someone confirm the wiring i have is correct or incorrect.


Give us a complete photo of your setup and we may be able to do this.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 08:25 pm

as far as capacitors and resistors i haven't used any simply because i do not know where they go or how many and nobody showed me that.


I linked this page before. Did you visit it?

http://www.gammon.com.au/forum/?id=11516

Here's a diagram from that page:

(http://www.gammon.com.au/images/LDS-5461-schematic.png)

Quote

is it really that complicated to get this single 3 digit segment display to work?


It shouldn't be. Since you have worked out the pin-outs can you use a meter, or a 5v power supply and a resistor (like 220 ?) in series, and work out which way around the LEDs are. You know the common pins (8, 9, 12). Are they anodes or cathodes?

Quote

tons of "experts" on here and we can't get this display to work?


"We?". If you expect help you need to do better than a graphic with a few boxes and coloured lines. We aren't mind readers, experts or not. Draw exactly how you have wired it up, using pencil and paper if you have to, and scan it it. And/or take a photo. And post the exact code you are using. A one-line bug in the code, or a single wire in the wrong place can do it.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 08:26 pm
image 1: http://cdn.img42.com/2513ad9a3bed0caca272d8150ff9f7a2.jpeg

image 2: http://cdn.img42.com/f6acb94b233f0db61910b3859e1218d7.jpeg

just shows 888 or (blank if i unplug and replug it a few times)


@ nick - anodes.. already been mentioned, and as far as "taking it out" on anyone,  i'm not - just venting.. 2 days here and i still all i see is 888 being displayed. so yes, i am a little frustrated.

ps
and yes, we know we are getting help for free, we all know this - i wish people would stop rubbing that into new people's faces already. we appreciate the help, but that doesn't mean we can't vent at times.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 08:27 pm
What have you got on pin 18 of the MAX7219? That controls current output, and you aren't indicating anything in your earlier reply. Without current control you can burn out your LEDs.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 08:35 pm
18 is empty - i'm not using 18 at all

Quote

PIN                              Max7219
1 = E                         21
2 = D                      23
3 = DP                      22
4 = C                      20
5 = G                      17
7 = B                      16
8 = common      6
9 = common      11
10 = F                      15
11 = A                      14
12 = common      2

DIN - 13
clock - 11
load - 10

max - 4 & 9 ground
max - 19 power with resistor

that's how i have it wired


as stated and shown earlier
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: arduinodlb on Dec 01, 2013, 08:37 pm

ps
and yes, we know we are getting help for free, we all know this - i wish people would stop rubbing that into new people's faces already. we appreciate the help, but that doesn't mean we can't vent at times.


Actually, yes it does. You need to walk away for a few hours and calm down. Just because YOU can't get it to work doesn't mean you can vent on US. Go face a mirror, vent at yourself, then come back and consider the way you are approaching people who are trying to help you.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 08:42 pm

@ nick - anodes.. already been mentioned, ...


Well, glancing back up the page:

Quote

... as far as AX or BX i do not know ...


I want you to know, and if you don't, find out. Measure it, like I suggested.

Having things not work until you get everything right is actually quite normal. There must be dozens of projects where I try things, and the gadget stubbornly displays nothing, or the wrong thing. I then carefully check everything. Wiring, sketch, datasheets. Then if that doesn't show the problem I start measuring things. Remember, there may be more than one thing wrong. It might not be a case of someone not noticing the wrong wire. You might have a wrong wire and a bug in your code.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 08:46 pm

18 is empty - i'm not using 18 at all


Well it's not supposed to be empty. Reply #50 showed a resistor. I showed a resistor. You have to use it.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 08:50 pm
Quote

I want you to know, and if you don't, find out.


i gave you all the info, where it was bought, who it was bought from what it's description is, contacted the seller and posted what they gave me. i cannot tell you anymore than that.. sorry.

i have given a diagram of exactly how it is connected, shown pictures, described in writing.. what more can i do? i caught the code error and changed that.. and all i see is 888 lit up.

i'm just going to go buy 2 different ones from radio shack or somewhere.. obviously these aren't going to work.

and no i don't have a multimeter.. not going to buy one either just for this..
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: cupstacker on Dec 01, 2013, 08:52 pm
why on earth would you need a resistor on a pin that is not even being used? :smiley-roll:

but ok, to ground i assume?
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: arduinodlb on Dec 01, 2013, 08:52 pm
Quote from: cupstacker

yer funny.. like you never got aggravated or pissed off in the heat of the moment and didn't vent right there and then at whatever it was and let others know about it in your whole.. i find that hard to believe


I do NOT appreciate personal messages sent to me like this.

Your behaviour and attitude on this forum is frankly unbelievable, and certainly inappropriate. I am done helping you.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: AWOL on Dec 01, 2013, 09:02 pm
I'm finding it hard to believe that it takes 67 posts to get a three digit display to not work.
Cupstacker, a multimeter costs less than a bottle of wine, and you don't need to be 18 to buy a multimeter.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 09:07 pm

why on earth would you need a resistor on a pin that is not even being used?

but ok, to ground i assume?


Don't assume, read what we post!

I gather from that statement that you have no plans to look at the schematics that either I posted, or CrossRoads posted, but are going to sit there and complain. It isn't being used until you put the resistor there! And the circuit clearly shows it going between the pin and +5V. In my diagram it was a 33k resistor. So you are not paying attention.

It's not our fault if you bought a part that doesn't work, and it's not our fault if you won't read the schematics.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 09:17 pm
That's enough, thread locked.

Insulting people who are trying to help you isn't useful.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: CrossRoads on Dec 01, 2013, 10:58 pm
Oh, you've got a Mega.  Need to use the Mega SPI pins - someone posted earlier what they are.

I see the big problem as this: You've indicated that you have a Common Anode display. MAX7219 only works with Common Cathode.
So, find a common cathode part.
Title: Re: SINGLE 3 DIGIT 7 SEGMENT LED
Post by: nickgammon on Dec 01, 2013, 11:05 pm
Related thread:

http://forum.arduino.cc/index.php?topic=202214