7 seg displays

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi people, just wondering if anyone has had any experience with the 8x7 seg display board from futurlec and how to control it.
[url] http://www.futurlec.com/8x7_Segm...
any examples would be great but just tips hints or tricks will be awesome.
cheers!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not using the Futurlec board but have been working with a 4 digit display connected to the MAX7219. Fortunately it is a very easy chip to control. Here is a test program I wrote. This should work as-is on your board but will only access 4 of the digits (I presume the right 4). Change the 3 to a 7 in the following line to control 8 digits:

	Send(0x0b, 0x03);	// 4 digits

This code assumes the MAX7219 is connected to PORTA:
A0 - MAX7219 DIN (pin 1)
A1 - MAX7219 CLK (pin 13)
A2 - MAX7219 LOAD (pin 12)

It also presumes that nothing else is connected to PORTA so justs sets the port value directly and not individual bits in the port.

I looked at the description of the Futurlec board and it indicates that it uses four pins from the microcontroller. The MAX7219 only requires three pins to interface to it so I'm unsure of why they are using 4 pins or perhaps their description is incorrect!

You probably will not need the delays in the Send routine. I have run mine on a 8 Mhz clocked AVR with and without the delay and it works either way.

Good luck!

//
//	send value to specified register in MAX7219
//

void Send(unsigned char reg, unsigned char value)
{
	// combine register and value into sixteen bits

	unsigned int data = reg;
	data <<= 8;
	data |=value;

	// lower chip enable

	PORTA = 0;

	// send each bit and toggle strobe
	unsigned int mask = 0x8000;

	for (; mask; mask>>=1)
	{
		unsigned char bit = (data&mask) ? 1 : 0;
		PORTA = bit;
		_delay_us(1);
		PORTA = bit|2;
		_delay_us(1);
	}

	// raise chip enable

	PORTA = 4;
}

int main()
{
	// MAX7219 connected to port A lower 3 bits:
	//		A:0 - data
	//		A:1 - strobe
	//		A:2 - chip enable (active low)

	DDRA = 7;
	PORTA = 4;

	// initialize 7219

	Send(0x0c, 0x00);	// shutdown during setup
	Send(0x0f, 0x00);	// disable display test
	Send(0x0b, 0x03);	// 4 digits
	Send(0x09, 0x0f);	// numeric decode
	Send(0x0a, 0x08);	// half intensity
	Send(0x0c, 0x01);	// enable

	// count from 0 to 9999 forever

	int i = 0;
	while (1)
	{
		if (i>9999)
			i = 0;

		// convert to individual digits

		unsigned char d0 = i%10;
		unsigned char d1 = (i/10)%10;
		unsigned char d2 = (i/100)%10;
		unsigned char d3 = i/1000;

		// send each digit

		Send(0x04, d0);
		Send(0x03, d1);
		Send(0x02, d2);
		Send(0x01, d3);

		i++;
		_delay_ms(1000);
	}
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually the quickest test is to use the display test feature of the MAX7219. You can replace everything following the line:

// initialize 7219

with:

Send(0x0f, 1);

and it should light up all segments of all 8 digits on the board.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jayelbee wrote:
Actually the quickest test is to use the display test feature of the MAX7219. You can replace everything following the line:

// initialize 7219

with:

Send(0x0f, 1);

and it should light up all segments of all 8 digits on the board.

That would be equivelent to the "Lamp Test" on the 7447/7448 BCD to seven segment LED display drivers.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hey thanks heaps guys..your a great help.. ill let u know how i go. but for now ive gotta go out so. cya
Dan 8)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hay the code worked just fine.. thanks very much.. im now editing it to match my needs. 8)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi again. the code was working fine until I unpluged all the wires.. now it will not work AT ALL.. ive been fiddling for hours now but still nothing... how easy is it to damage these chips.. if i had the polarity wrong, could that destroy it. i made 1 note however, when i put the 7219 in backwards it turns on 6 of the digits.. but that could be anything ... thanks
Dan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jeez

I think you have done the damage by putting it backwards.
Has the current increase or the chip get hot or the display are bright/dim and any missing segment?
Try another chip. Try Futerlec or Farnell or RS for another chip.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

danrulz01,

I sent you a "PM".

If you have a bench-top power supply, I'd try powering your project with that and see if you are drawing excessive current. If so, start pulling chips until the current drops to a reasonable value. At that point, you've probably found the defective I.C.. I make this recommendation because of your statement...

Quote:
however, when i put the 7219 in backwards it turns on 6 of the digits..

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hmmm, i dont think i did do the damage by inserting it backwards as it was playing up before that. but your quite right, that could damage it... i dont have a spare one yet but im getting some samples from maxim... no it dosent get hot. cheers

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a quick question.
Did you have any protection like series resistors for your data, clock & load from your AVR chip ?
Or you could try a different port to be sure the AVR is not the problem.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Ken. Im posative it is not the Avr as i tried the stk500 using mega16 and the mega control board using the mega 32. as for protection i dont think so, then again im not too sure as i dont really know what u mean there (newbie :oops: ) cheers!
Dan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Dan

Just forget about the protection side for the moment.

All I was saying is just move your data, clock & load connection to a different port pins.
Then modify your code to reflect your new location.

Like originally you have these connected up to
A:0 - data
A:1 - strobe
A:2 - chip enable (active low)

Move this to a different location like
B:0 - data
B:1 - strobe
B:2 - chip enable (active low)

This is only an example.

Like you said you have tried M16 & M32 & the problem is still the same. So the AVR are fine.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dan,

You mentioned that you unwired the project in some way. I don't know exactly where you are in your learning experience so, I offer the following.

I am assuming you are using a proto-board.
When adding or removing interconnecting wiring, make sure you remove power.

One issue is that, if you have voltage connected to VCC and you have an input (or inputs) to that chip connected to a logic low (GND) voltage level, a condition can exist that if you accidently loose the supply comon connection to the GND pin of that chip, you could possibly destroy the IC. There are many layers of semiconductor material within any integrated circuit. The problem is that, if you reverse-bias an input pin from VCC to the substrate or some other semiconductor layer within the IC due to a loss of VDC comon to GND, the IC very easily becomes damaged due to excessive and uncontrolled current. More specifically, the input protection diodes can possibly forward bias and become damaged causing inproper and in-operable input logic levels. This could possibly explaine the odd behaviour of your LED driver IC.

This is one of the inherent dangers of using a proto-board and is, in many cases, why so many individuals experience un-explained component failures when using proto-boards. As the proto-board ages and, if used heavily, the little spring connectors within the proto-board loose their tension and even become corroded. If an IC conponent is inserted into a section whose GND pin is in a defective hole, the IC component can easily become damaged.

The next piece of counsel is that, when connecting and removing power from the proto-board, make the VCC connection last and always remove the VCC connection first and wait a few seconds for any on-board capacitors to discharge before removing GND. In addition, if using multiple voltages of say, +12 VDC, and +5 VDC, always connect the higher voltages last and dis-connect the higher voltages first - unless instructed otherwise in the manufacturers datasheet.

When using +/- DC voltages, always consult the manufacturers datasheet to see if there are any precautions on proper power up sequencing.

Also, DO NOT REMOVE ANY GND CONNECTION FROM ANY SYSTEM WHOSE SUBSYSTEMS ARE SUPPLIED POWER FROM INDIPENDANT SUPPLIES AND SHARE A COMON GND REFERENCE BETWEEN SUB-SYSTEMS! I.E. The STK500 being one sub-susyem and the proto-board being another sub-system. This will possibly do damage to the components within the sub-system whose GND has been removed.

If working on carpet, always touch something grounded - to earth ground - before touching any wiring or pins associated with integrated circuits. I usually work bare foot as I have learned that static build up is minimal when not wearing shoes. The shoes act as a dielectric and enhance static charge build up.

As I said, I don't know where you are in your learning experience and I thought I'd offer a few tid-bits of my experience over the years.

While I can't really help you with your imediate component failure, I hope this helps with future endeavours...

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

Last Edited: Sun. May 21, 2006 - 03:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dan

Here is the schematic for protection.
Personally I include these extras as an insurance.
But then It is up to you.

Ken

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks Carl, alot of that i didnt know. how do i get the schematic ken thanks. thanks once again for all the valuable input.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Dan

I use the RFFlow & then do a screen capture of it.
But if you want to use a schematic editor, you could use "EAGLE Layout Editor".
http://www.cadsoft.de/

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is one more thing you could try. It is very easy to put the MAX7219 into display test mode by hand, i.e., with a power supply connection and three wires.

Any command to the MAX7219 looks like:

R R R R R R R R V V V V V V V V

where R is the 8 bit register and V is the 8 bit value to load.

Display test is activated but setting the value of 1 into register 15. So the command for display test looks like:

x x x x 1 1 1 1 x x x x x x x 1

where x is don't care. Therefore the command:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

puts the MAX7219 into display test mode.

So:

(1) tie the DIN pin high.
(2) initially connect CLK low.
(3) initially connect CS/LOAD low.

Now apply power.

(4) toggle the CLK line between high and low (at least) 16 times. If you're doing this by hand you're going to be getting bounces on the line but that is OK.
(5) now connect CS/LOAD high

You now should see all segments of all digits set on the display.

I actually found that you do not even have to clock in any data, i.e., you can omit step 4. This is not documented but I assume it is because the internal buffer of the MAX7219 must be initialized as all 1's at power up and if you do not send it any data before a rising edge on CS/LOAD that it loads these 1's as the command.